Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 23 Jul 2007 @ 14:15:07 GMT


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


Subj:   Re: MAX vs rank-qualify
 
From:   Barry Hull

The OLAP functions will always redistribute the qualifying rows of the table by values (based on partition and order by clause). The normal aggregate functions can avoid a redistribution if the primary index columns are the same or a subset of the columns that you're using in your "GROUP BY" clause.

If you run an explain on the aggregation case, you can see whether or not a "local" aggregation or a "global" aggregation is performed. If a "local" aggregation is performed, then the rows are not being redistributed and this may turn out to be faster. If the aggregation is not local, then I would think the OLAP function would turn out to be better.

If this is something that you're going to run often, I would suggest that you try it both ways and capture the CPU and IO used by both to determine which is the best approach.


Regards,

Barry

Barry Hull
Orange Diamond Consulting, LLC



     
  <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