Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 15 Dec 2001 @ 15:47:58 GMT


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


Subj:   Re: Exists/Not Exists versus IN/Not IN
 
From:   David Wellman

I think you'll find that exists/not exists is faster than in/not in.

This is because with exists/not exists, the outer query simply says "has the inner query returned ANY rows" and on that it result the exists/not exists is triggered (or not !).

With the in/not in option, EVERY row in the inner query is matched to the appropriate column(s) in the outer query. If the inner query has 000's of rows this may not give you a sub-second query time !

There are also some differences when the inner query returns NULLs, but I think you'll find that the above is the meat of it.

Dave



     
  <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: 27 Dec 2016