Re: Multicolumn indexes and ORDER BY - Mailing list pgsql-general

From Tom Lane
Subject Re: Multicolumn indexes and ORDER BY
Date
Msg-id 21892.1087396355@sss.pgh.pa.us
Whole thread Raw
In response to Re: Multicolumn indexes and ORDER BY  (Jernej Kos <kostko@jweb-network.net>)
List pgsql-general
Jernej Kos <kostko@jweb-network.net> writes:
> Yes i tried that already - and as you said, it works. But i need to have one
> column sorted DESC and one ASC. Is there any way this could be done ?

Not easily.  You could look into building a "reverse sort" operator
class for one index column or the other.  There is discussion of how
to do this in the archives, but I don't know of anyone having actually
gotten off their duff and done it.  For reasonable index performance
this would require writing at least one function in C (a pretty trivial
one, but nonetheless a C function).

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.4 performance issue
Next
From: Stephan Szabo
Date:
Subject: Re: reference to a view