Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 11 Feb 2005 @ 20:34:55 GMT

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

Subj:   Re: Guidelines for using Distinct vs. group by
From:   Hough, David A

Yes, that's what he's saying: all subqueries have an implicit distinct. If you think about it, it makes sense. No matter how often a value appears in the subquery result, you only need to find one value to have success, hence the rest are redundant.

This leads into a number of questions:

* Does the SQL standard call for a DISTINCT in the subquery, or is it left to the implementers?

* Is the DISTINCT versus GROUP BY implementation difference on the Teradata unique to this platform (perhaps because the data is partitioned on many nodes)?

* Does anyone have benchmark results for DISTINCT versus GROUP BY performance on the Teradata for different result set percentages?

I would expect GROUP BY to be best if the result set row count is <1% of the table row count, and I would expect DISTINCT to be best if the result row count is >99% of the table row count. But I don't know, and certainly don't know about the gray area in between.

/dave hough

  <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