JSON Data Type | Maximum Length | VantageCloud Lake - Maximum Length of a JSON Instance - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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.

  1. 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*/
  2. 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.