Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 23 Feb 2009 @ 20:13:48 GMT


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


Subj:   Re: Too much time spent on aggregate function
 
From:   Dieter Noeth

Simard Rudel wrote:

  I did some text with exemple you show me and unfortunately MAX function run faster than the proposition.  


  Interesting to see the difference between explain plan.  


  I included the explain on the query and the number I/O and total CPU time from DBQL :  


Of course an aggregate is more efficient for your queries, i thought you need to return more columns like

     SELECT *
     FROM  TADR
     qualify rank() over
         (partition by NO_VIV, COD, D_PER
          order by PER)= 1;

vs.

     select * from TADR
     where (NO_VIV, COD, D_PER, PER)
     in
     (SELECT  NO_VIV
              ,COD
              ,D_PER
              ,MAX(PER)
     FROM  TADR
     group by NO_VIV, COD, D_PER);

Could you post the actual activity query?


Dieter



     
  <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