Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 27 Nov 2012 @ 12:35:55 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Doubt with indexes
 
From:   Kenneth Hansen

Maria,

when your SQL fails to state specific dates but simply the parameters, e.g. using BETWEEN or < >, the Teradata does not know how many dates there are and appears to need to identify them. I suggest you join the main query to a smaller query identifying the dates and think the source you want is SYS_CALENDAR - please check that. Give both the table and the query an alias e.g. t1 & t2

     SELECT * FROM FINA_BORRAR t1
     Inner join
     (SELECT DATE from SYS_CALENDAR WHERE DATE BETWEEN (   x , y )) t2
     On t1 fec_inicio_vigencia = t2.DATE)
     ;

This should result in t2, the list of valid dates, being replicated across all amps for a join which is far more efficient than a row by row read and comparison of fec_inicio_vigencia with your parameters.


Kenneth Hansen



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