Re: Does anybody use ORDER BY x USING y?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Hannu Krosing <hannu(at)skype(dot)net>, John Hansen <john(at)geeknet(dot)com(dot)au>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Does anybody use ORDER BY x USING y?
Date: 2005-09-19 15:33:34
Message-ID: 27628.1127144014@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2005-09-19 15:45:10 Re: DISTINCT vs. GROUP BY
Previous Message Greg Stark 2005-09-19 15:24:33 Re: Does anybody use ORDER BY x USING y?