In some rare cases, you may be forced to collect statistics on large character columns.
Probably you never recognized it, but, until release 13.10, Teradata was restricting the number of bytes considered for building the statistics histograms to 16.
This restricting means, all characters past the 16th bytes have been cut-off.
The column value “012345678901234567890” actually was considered as “0123456789012345”.
Cutting off after 16 bytes lead to wrong estimations which are tough to detect.
Teradata Statistics MaxValueLength is an enhancement to Teradata statistics, which improves the situation.
With Release 14, Teradata increased the number of considered bytes to 25 by default. If the 25 bytes are not enough, you can override this default value with below syntax:
COLLECT STATISTICS USINGMAXVALUELENGTH 100 COLUMN (<COLUMN>) ON <TABLE> ;
In above example, 100 bytes would be used to build the histogram on column <COLUMN>