Archives of the TeradataForum
Message Posted: Sun, 02 Mar 2003 @ 14:47:57 GMT
Oh ok, so my fingers typed before the brain was fully engaged...
The Set/Multiset option is not irrelevant. Obviously if you had lots of NUPI duplicates and no unique indexes defined on the target table then the duplicate row checking will be an overhead.
So, what's the real scoop?
A Teradata sub-query will always return unique rows. If you don't specify GROUP BY or DISTINCT then Teradata will use DISTINCT logic. GROUP BY is better than DISTINCT when the 'group by' columns contain lots of duplicates.
So, ending up with only 10 rows out of 'lots more' will almost certainly be better with GROUP BY rather than DISTINCT. But (as someone else said) the source table is only 100,000 rows, so is it going to make that much difference? Unless of course a large percentage of your source data has the same value for the column that you are grouping on.
Grovelling apologies to all and sundry.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|