The maximum length of a JSON type is variable. The JSON type has a default maximum length, but that length can be adjusted in places where the type is used like the VARCHAR data type. The length can never exceed the absolute maximum length, but the maximum length defined for an instance of the JSON type may be shorter than the absolute maximum length.
The absolute maximum length is the largest possible length for a JSON type. This limit is 16776192 bytes.
- Using a supported load utility, load binary JSON data into an intermediate table with a CLOB column.
CREATE TABLE clobTable(id INTEGER, c CLOB); /*load many rows of data*/
- Use a query such as the following to determine the length needed for a JSON column which uses a binary format:
SELECT MAX(NEW JSON(c).StorageSize('BSON')) FROM clobTable;
This is one way to determine the smallest possible size for a JSON column. If space is not an issue and there is no need to receive the performance benefits of a smaller JSON, then Teradata recommends to use the maximum possible size for the JSON column.