Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 09 Sep 2004 @ 15:42:33 GMT


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


Subj:   Re: Optimizing SQL
 
From:   Fred Pluebell

Are you sure your UPDATE statement is logically correct? AND has precedence over OR, so I think you want parentheses around the last two OR'ed conditions. As written, this statement will fail if there is a NULL last_sale_date in the target table and the source table has more than one row. This will likely make a big difference in the query plan and performance as well.

And is there some reason why (branch_id, customer_no) is not a UNIQUE primary index? Again, you will have problems if more than one qualifying row with the same (branch_id, customer_no) occurs in the source table.



     
  <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