Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 08 Mar 2007 @ 13:47:15 GMT


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


Subj:   Re: Performance of a self join
 
From:   Goutham P

Hi All,

Join to the derived table seems to be faster than having two OLAP functions without the join. So I am using the same approach with a small tweaking the following way.

     select        A.*
     from         A,
     (
              select        dim1
                     ,dim2
                     ,dim3
                     ,dim4
                     ,dim5
                     ,metric 1/count(metric 2) as value2
                                    ,sum(Value2) over (partition by A.dim1,
     A.dim2, A.dim3, A.dim4) as value3
                            ,value2/value3
             from        A
             group by 1,2,3,4,5
     ) B
     where        A.dim1 = B.dim1
     and        A.dim2 = B.dim2
     and        A.dim3 = B.dim3
     and        A.dim4 = B.dim4
     and        A.dim5 = B.dim5
     and        A.dim6 = B.dim6

Thanks much to each of you for all your help.



     
  <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