Re: ORDER BY and DISTINCT ON - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ORDER BY and DISTINCT ON
Date
Msg-id 5380.1071458255@sss.pgh.pa.us
Whole thread Raw
In response to Re: ORDER BY and DISTINCT ON  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: ORDER BY and DISTINCT ON
List pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
> If the sort used to select the records sorts on both the distinct
> expressions and the order by expressions you will get a sensible
> deterministic result.

Sensible in what sense?  ;-)

It seems to me that the existing documentation defines the behavior of
DISTINCT ON as selecting the row within each DISTINCT ON group that is
first according to the ORDER BY columns that are less significant than
the DISTINCT ON keys.  Perhaps this is not clear enough and should be
clarified.  But it doesn't seem very useful to me to extend the behavior
to allow other cases ... what are you really buying if you do so, and
what will it cost in execution time?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ORDER BY and DISTINCT ON
Next
From: Tom Lane
Date:
Subject: Re: Resurrecting pg_upgrade