Re: multicolumn index column order - Mailing list pgsql-performance

From andrew@pillette.com
Subject Re: multicolumn index column order
Date
Msg-id 200707240710.l6O7AUu24090@pillette.com
Whole thread Raw
In response to multicolumn index column order  (valgog <valgog@gmail.com>)
List pgsql-performance
valgog <valgog@gmail.com> wrote ..
> On Jul 23, 7:00 pm, t...@sss.pgh.pa.us (Tom Lane) wrote:
> > valgog <val...@gmail.com> writes:
> > > how to build an multicolumn index with one column order ASCENDING and
> > > another column order DESCENDING?
> >
> > Use 8.3 ;-)
> >
> > In existing releases you could fake it with a custom reverse-sorting
> > operator class, but it's a pain in the neck to create one.

I've often gotten what I want by using a calculated index on (f1, -f2). ORDER BY will take an expression, e.g. ORDER BY
f1,-f2. Simpler than a custom operator. 

pgsql-performance by date:

Previous
From: "Valentine Gogichashvili"
Date:
Subject: Re: multicolumn index column order
Next
From: "Jonathan Gray"
Date:
Subject: Query performance issue