Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 27 May 2011 @ 09:42:16 GMT


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


Subj:   Recursive SELECT from the same table
 
From:   Anomy Anom

<-- Anonymously Posted: Friday, May 27, 2011 03:23 -->

Hi,

I have a query which is as below

     Sel
        Col1,col2,col3,col4,col5
     From table1 where col1 > 100
     UNION ALL
     Sel
        Col1,col2,col3,col4,col5
     From table1 where col2 is not null
     UNION ALL
     Sel
        Col1,col2,col3,col4,col5
     From table1 where col5 =  X

Is there any way to rewrite the query. The query does repeated scans of the same table and there is no correlation between the multiple WHERE conditions.

Is there any way spool the full table scan and from the spool try applying the filters to get the required resultsets into separate spools and finally join them.

Let me know


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