Specifies the maximum default length of fields that are mapped as VARCHAR when a multiplier is specified for the DefaultVarcharSize configuration option (DefaultVarcharSize=multiplier).
MaxVarcharSize limits the size of the default length of VARCHAR fields that are determined by multiplying the multiplier value of the DefaultVarcharSize configuration option by the largest value detected in that column. When the largest value detected is significantly larger than the rest of the data in the column, this option can improve the memory efficiency of applications by limiting the size of the default length and, therefore, the amount of data stored in a field.
Valid Values
x
where:
x
is the maximum size of the default length in characters given to columns that are mapped as VARCHAR.
Example
For example, MaxVarcharSize is set to 3000 and DefaultVarcharSize is set to 3x. When the largest detected value in a column mapped to VARCHAR is 500 characters, the driver determines that the default length for that column is 1500 characters by multiplying the largest detected value (500) by the setting of DefaultVarcharSize (3). However, suppose the largest detected value is 2000 characters. The driver calculates a default value of 6000 characters, but, since this would exceed the value for MaxVarcharSize, the default length is set to 3000 characters.
Notes
This option can improve memory efficiency of applications by limiting the size of memory stored in VARCHAR fields.
When a column with a String size greater than 4000 is discovered, the column is mapped as LONGVARCHAR and precision is 16 MB.
You can configure a minimum limit for the default length of fields that are mapped as VARCHAR using the MinVarcharSize configuration option.
The default length of fields for columns mapped as VARCHAR can be overridden using the Schema Tool. See About Column Information and Statistics for details.