Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 01 Jul 2003 @ 09:45:21 GMT


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


Subj:   Re: How to fetch specific number of rows
 
From:   David Wellman

Andy,

I accept that manuals aren't always 100%, absolutely accurate (but you've got to start somewhere). As per the manual, the SAMPLE clause operates on the result of the SELECT statement, e.g. after the WHERE, GROUP BY, HAVING etc clauses have been applied. So if you have any WHERE clause etc within your SELECT, the optimizer will generate the appropriate plan to answer that question FIRST, then apply the sampling.

Whether this is what you really want or not is another matter, but that is what is happening. So the only way (that I've ever seen) to get a quick SAMPLE when you have a WHERE clause is to code the SAMPLE clause in a derived/volatile table, and then supply the output from that into another SELECT statement.

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: 15 Jun 2023