Quantcast
Channel: Teradata Developer Exchange - Blog activity for carrie's blog
Viewing all articles
Browse latest Browse all 1058

New opportunities for statistics collection in Teradata 14.0 - comment by carrie

$
0
0

Hi Nazy,
 
The 32 bytes I mentioned is not directly related to MAXVALUELENGTH.   MAXVALUELENGTH only applies to the number of characters that are stored in the histogram intervals value fields at the time those values are moved into the histogram intervals.     
 
The 32 bytes is used during the aggregation process to determine the number of distinct values and the interval buckets.  The stats aggregation process  uses first 32 bytes of each column in the multicolumn stat when it performs its aggregation.  This happens automatically, and you don't need to set anything up to make it happen.  Also, you cannot increase or decrease that value. 
 
After the aggregation process is complete, MAXVALUELENGTH is used to determined how many characters should be moved into the values fields in the histogram intervals.   The default is 25.
 
So you do not need to change MAXVALUELENGTH to be 32 bytes for each column included.   
 
For your four columns (A, B, C, D), the number of unique values for the entire statistics will be calculated based on taking the first 32 bytes from the beginning of each column and combining them.   Depending on your demographics, the numer of unique values that results should be pretty close to accurate.
 
With no MAXVALUELENGTH specified, the histogram value columns will contain all of colum A (10 bytes) plus part of column B (the first 15 bytes) and nothing from column C or D.  The greater you make the MAXVALUELENGTH, the more complete the histogram interval information will be.   And as you say, doing MAXVALUELENGTH = 140 will cover all four columns completely.
 
However, increasing MAXVALUELENGTH too greatly will tend to increase the size of the histogram.   Usually the optimizer will reduce the number of intervals or the number of biased values to compensate, so the entire histrogram doesn't grow too large.   So it's best to only use MAXVALUELENGTH up to a size that you actually need for differentiation.
 
Thanks, -Carrie


Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>