Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How does DISTINCT work?
On Thu, 19 Aug 1999 11:46:25 +0400, "Oleg Roshchin"
<oleg_at_ca-ib.com> wrote:
>How does DISTINCT work: during the selecting or after it?
I suspect in most cases that a sort is required, but I also
wouldn't be surprised if Oracle has more than one way to
approach this. You would need to do an EXPLAIN PLAN on your
specific query to find out for sure.
>What is more efficient: DISTINCT or GROUP BY
>when GROUP BY is used for all fields in the query?
I would tend to use DISTINCT, because it sounds like that is what you really *mean*. Using GROUP BY might confuse future developers who had to maintain the query. I would have to test it both ways to see which was more efficient.
Jonathan