Re: Multicolumn indexes and ORDER BY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jernej Kos <kostko(at)jweb-network(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multicolumn indexes and ORDER BY
Date: 2004-06-16 14:32:35
Message-ID: 21892.1087396355@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jernej Kos <kostko(at)jweb-network(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2004-06-16 14:57:59 Re: reference to a view
Previous Message Jean-Luc Lachance 2004-06-16 14:14:14 Re: How to delete the not DISTINCT ON entries