Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 26 Sep 2003 @ 15:29:09 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Date and numeric datatypes
From:   Figge, Jason

Changing Dates into Integers will not buy you any performance gain. This is because a date is already treated as an integer by Teradata; for example, 09/26/2003 is stored as the integer value 1030926. Since the integer representation of a date is in reverse format, i.e. yyymmdd, new dates will always produce larger integer values. Consequently Teradata doesn't need to interpret a date prior to comparison and so performing date comparisons is just as efficient as integer comparisons.

What might help you get better performance is if you created an non unique secondary index (NUSI) on the ht.Eff_dt and specified it as an ORDER BY VALUE index. This way Teradata can perform a binary search (fastest possible method) to get the range of dates you need. If you don't create the index then Teradata must scan each record and look for potential matches.

Be sure to collect statistics on the index (or else Teradata won't use it) and keep the stats fresh (no more than 10% deviation from the base table as a rule).

Hope this helps,


  <Prev Next>   <<First <Prev
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020