Re: Does anybody use ORDER BY x USING y? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Does anybody use ORDER BY x USING y?
Date
Msg-id 27628.1127144014@sss.pgh.pa.us
Whole thread Raw
In response to Re: Does anybody use ORDER BY x USING y?  (Greg Stark <gsstark@mit.edu>)
Responses Re: Does anybody use ORDER BY x USING y?
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> The thing is that these opclasses you're describing are closely related. It
> ought to be possible to use a single index to produce results in any of the
> four orders you describe.

Wrong --- only two of them.  You can't magically swap nulls from one end
of the index to the other (and Hannu's flight of fantasy about double
indexscans is just a flight of fantasy; it would be solving the problem
at entirely the wrong place).

> These aren't all related in the same way.

They are all desirable properties of an index column, however.  In
particular, we do have a market for genuine reverse-sort columns,
so that you can use a double-column index to get orderings like
ORDER BY x ASC, y DESC.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Does anybody use ORDER BY x USING y?
Next
From: Greg Stark
Date:
Subject: Re: DISTINCT vs. GROUP BY