Vertica Quick Tip: What’s the Maximum Column Size?

Posted March 28, 2018 by Soniya Shah, Information Developer

Designers discussing project in office sample library
This blog post was authored by Jim Knicely. There exists a maximum number of characters that can be stored in columns having a data type of VARCHAR or LONG VARCHAR. In case you’ve forgotten those maximum values for the version of Vertica you are using, there are two handy functions that provide this information. Example: To find the maximum characters that can be stored into VARCHAR field: dbadmin=> SELECT get_max_attr_size(); get_max_attr_size ------------------- 65000 (1 row) dbadmin=> CREATE TABLE test (c1 VARCHAR(65001)); ERROR 3852: Length for type varchar cannot exceed 65000 To find the maximum characters that can be stored into LONG VARCHAR field: dbadmin=> SELECT get_max_long_attr_size(); get_max_long_attr_size ------------------------ 32000000 (1 row) dbadmin=> CREATE TABLE test (c1 LONG VARCHAR(32000001)); ERROR 3852: Length for type long varchar cannot exceed 32000000 Have Fun!