Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select Distinct (was top N or rewriting MAX)
Jim Smith wrote:
>
> In article <32DEC3C1.7393_at_rci.rogers.com>, AWILSON
> <awilson_at_rci.rogers.com> writes
> >
> >How does Select Distinct work - ie what mechanism does it use to ensure
> >distinctness?
> It sorts the results and then does a table scan of the sorted set
> returning distinct rows. It may be able to use an index to achieve the
> same result, but in either case the ordering of the result is an
> accident.
>
> >Can it be relied upon to work the same way in future?
> >
> The safe answer is no, but I can't think of any mechanisms which would
> not result in a sorted set. Any clever computer science types out there
> who know of ways to achieve this?
> --
> Jim Smith
I think we can be quite sure of a sorted return BUT you may not be able to rely on whether it is sorted ascending or descending.
-- Sport radio: people listening to people watching people having fun Mailto:roger.wernersson_at_adra.se BTW: All opinions are mine, all mine, and nobody's but mine.Received on Mon Jan 20 1997 - 00:00:00 CST