Archives of the TeradataForum
Message Posted: Tue, 30 Nov 2004 @ 21:43:03 GMT
Subj:   Dates not hashing evenly 

From:   Geoffrey Rommel 
As you know, dates are stored internally as integers. Also, a series of consecutive dates contains gaps if we view the dates as integers. For
instance, the sequence of "consecutive" dates 20031230 through 20040102 is actually the sequence
1031230
1031231 /* gap here */
1040101
1040102
and, of course, there are similar gaps elsewhere between months.
Now, if we use a date as the primary index, the distribution turns out to be less even than we might like. I defined a table with a date as the
primary index and stored twenty years' worth of consecutive dates in it. The ratio max(CurrentPerm)/avg(CurrentPerm) is near 1.0 for our better
tables, but for this table it is 1.26.
Now my question. Is this simply an unavoidable consequence of the gaps in the integer sequence, or might there be some way to make the hashing
of dates as even as that of integers?
