Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 23 Apr 2015 @ 12:59:08 GMT


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


Subj:   Re: Impact of using NOT IN vs AND condition
 
From:   Dieter Noeth

Anomy.Anom wrote:

  I ran the explain on both the queries and found that the plans were exactly the same. I believe that since its a non-equality condition then the query will result in a FTS anyway (for both instances).. Why is it that it is recommended that NOT IN clauses be avoided in queries?  


NOT IN with values is ok, only "NOT IN (SELECT...)" subqueries should be avoided, because then NULLs become an issue due to three-valued logic and the plan will be quite ugly when NULLable columns are involved. Then better rewrite to NOT EXISTS instead.


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