Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 01 Dec 2011 @ 16:28:24 GMT


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


Subj:   The "Group By" slows down the result in a query
 
From:   MARIA JOSEFA RODRIGUEZ POSADA

We have this query :

     SELECT
     Column1
     ,Column2
     ,Column3
     .
     ,Column19
     , SUM(column1)
     ,SUM(column2)
     ,SUM(column3)
     .
     ,SUM(column21)
     FROM
     TABLE1
     INNER JOIN TABLE2
     INNER JOIN TABLE3
     .
     INNER JOIN TABLE7
     GROUP BY 1, 2, 3?.19;

If we only run the from part with a COUNT, like it is showed below, it gets less than 1 minut to end:

     SELECT COUNT(1)
     FROM
     TABLE1
     INNER JOIN TABLE2
     INNER JOIN TABLE3
     .
     INNER JOIN TABLE7

But, if we run the query all together with the sum and the group by part the query lasts more than half an hour.

I've checked all the statistics with the ?diagnostic helpstats on for session

I think that I have all the indexes that I need, although I don't know if that can improve or not the result.

Any idea how to optimize this query? I'm going crazy here.

FINA RODRIGUEZ POSADA
Analista BI



     
  <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