Skip site navigation (1) Skip section navigation (2)

Re: multicolumn index column order

From: andrew(at)pillette(dot)com
To: valgog <valgog(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: multicolumn index column order
Date: 2007-07-24 07:10:30
Message-ID: 200707240710.l6O7AUu24090@pillette.com (view raw or flat)
Thread:
Lists: pgsql-performance
valgog <valgog(at)gmail(dot)com> wrote ..
> On Jul 23, 7:00 pm, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> > valgog <val(dot)(dot)(dot)(at)gmail(dot)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.

Responses

pgsql-performance by date

Next:From: valgogDate: 2007-07-24 07:33:55
Subject: Re: disable archiving
Previous:From: Jignesh K. ShahDate: 2007-07-24 04:09:00
Subject: Second SpecJAppserver2004 with PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group