GroupBy and DIstinct

Tools & Utilities
Enthusiast

GroupBy and DIstinct

hi,

what are the difference between Group by and distinct
5 REPLIES

Re: GroupBy and DIstinct

Hi,

The more duplicates you expect to eliminate, the more likely GROUP BY will perform better;
conversely, if you expect few duplicates, DISTINCT is likely to be better.

DISTINCT, "make a list, then remove duplicates".
GROUP BY, "check for matches as you go, before adding to the list".

Regards
mohantera@gmail.com
Enthusiast

Re: GroupBy and DIstinct

GROUP BY sorts the data locally on vprocessor while DISTINCT sorts the data after it is redistributed
Enthusiast

Re: GroupBy and DIstinct



we use group by or distinct only while retrieving data right, can you clarify on 'DISTINCT sorts the data after it is redistributed' - redistribution is used only while loading ?
Junior Supporter

Re: GroupBy and DIstinct



I wrote something about this issue (in Spanish) here:

http://carlosal.wordpress.com/2009/06/02/distinct-vs-group-by-en-teradata/

HTH.

Cheers.

Carlos.
Enthusiast

Re: GroupBy and DIstinct

Hi carlos,

Thanks for the update...if you got an english translation of the same..would be useful....!

Rgrds,
Rock