Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 02 Jul 2010 @ 19:24:03 GMT


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


Subj:   Re: Experiences with Teradata & Ms sql server
 
From:   John_Wight

Actually, the performance of DISTINCT and GROUP BY is really dependent upon the uniqueness of the GROUPed column value results. The more unique they are the better the DISTINCT performs and if very unique, can be faster than the GROUP BY - at least in my tests. This is because when using DISTINCT the optimizer will get all the values and redistribute them BEFORE it removes dups, If using Group By, it will remove the dups on the AMP before it redistributes. If you do an EXPLAIN on each you can see this. So I would expect that your 'grouped' column values are not very unique in this case.

I usually do GROUP BY by habit specially when I don't know the uniqueness of the grouping columns it's safer. However, if you do know and they are quite unique, DISTINCT can be as good if not better than the GROUP BY. Just a thought/tip I've discovered for what it's worth on today's market;-).


JK



     
  <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