Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sun, 06 Dec 2004 @ 00:58:14 GMT


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


Subj:   Re: Why is Group-by Faster than Distinct
 
From:   Michael Larkins

I agree 100% with Dieter regarding faster and more efficient performance of GROUP BY (with lots of duplicate values) versus DISTINCT (with few duplicates).

When you look at an EXPLAIN for a subquery you will notice that it no longer eliminates duplicates. In the old days it did a "sort" and "eliminate duplicate values" in the EXPLAIN. For a couple of releases now it eliminates duplicates without eliminating duplicates - how is that for efficiency. In reality what it does is an inclusion merge join instead of a merge join. The difference is that the inclusion merge stops looking for matches on a value in the subquery rows when it finds one that matches - hence no duplicates found. Pretty clever little cleaver.


Regards,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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