Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 15 Dec 2001 @ 12:59:48 GMT


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


Subj:   Re: Exists/Not Exists versus IN/Not IN
 
From:   Dieter N�th

  Which is usually faster, using exists/not exists or in/not. And in general why.  



There's almost no difference in Teradata between IN and EXISTS, just EXPLAIN both, it's the same plan.

EXISTS/NOT EXISTS will produce the same plan, the only difference is the join type: Inclusion vs. exclusion.

IN/NOT IN will produce totally different plans, if the joined columns are NULLable, because the optimizer has to consider the three-way logic of NOT IN.

So in most cases it's better to use NOT EXISTS, especially because you don't have to think about NULLs.


Dieter



     
  <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