Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 07 Feb 2011 @ 15:34:51 GMT


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


Subj:   Re: Which query will be faster ?
 
From:   Maccha Narayana Rao Naidu

Anomy.Anom wrote:

  1) SELECT * FROM ;
2) SELECT COUNT(*) FROM
;
3) SELECT * FROM
SAMPLE n ;
4) SELECT TOP n * FROM
;
 


Hi

3rd and 4th Query is quicker than the 3rd one any how the explain plan loos same for both the query except the sorting step for the 4th query as all-AMPs SAMPLING step will take longer time than all-AMPs STAT FUNCTION

2nd Query is the fastest among the four.

While comparing 1st and 2nd Query 1st one will do all-AMPs RETRIEVE and the estimate will be no. of rows in the table where as 2nd Query will do an all-AMPs SUM with an estimate will be one.

ideally there is no comparison between 1st and 2nd Query

Hope this helps I'm too looking for a better answer with internal mechanism


Thanks

Machha



     
  <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