Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How does DISTINCT work?

Re: How does DISTINCT work?

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Fri, 20 Aug 1999 03:44:50 GMT
Message-ID: <37cacb38.52200540@netnews.worldnet.att.net>


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



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are Received on Thu Aug 19 1999 - 22:44:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US