Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 01 Jul 2003 @ 06:38:55 GMT


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


Subj:   Re: How to fetch specific number of rows
 
From:   McCann, Andy

I've seen this issue also. If you specify any criteria in your select other than just select * the optimizer will go and derive the whole dataset and then sample from the spool generated (occasionally it samples twice?) The work around we use is to use a derived table :

sel *
from db.tbl
where condition
and PI_COLUMN in
(select PI_COLUMN from db.tbl sample 5);

This works quite well as it goes and gets the sample rows first, back into the table on the primary index then does any conditions. Of course, if you are joining tables in the query, it gets even more complicated as you can't possibly expect to get RI. If the view is very complex then getting this tow work takes some effort.


Cheers

Andy



     
  <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