Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 23 Apr 2015 @ 11:41:53 GMT


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


Subj:   Impact of using NOT IN vs AND condition
 
From:   Anomy Anom

<-- Anonymously Posted: Wednesday, April 22, 2015 17:10 -->

Hi,

What is the performance impact of using NOT IN clause vs <> conditions clubbed together by AND condition ?

For e.g. I have the following 2 queries -

     select * from Tab1
     where Store_ID NOT IN ('A', 'B');

     select * from Tab1
     where Store_ID <> 'A'AND Store_ID <> 'B';

     **Store_Id is the Primary Index of the table.

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 ?


Thanks



     
  <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