pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: andrew@pillette.com
To: valgog <valgog@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: multicolumn index column order
Date: Tue, 24 Jul 2007 00:10:30 -0700
Message-ID: <200707240710.l6O7AUu24090@pillette.com> (raw)

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.



view thread (7+ messages)  latest in thread

Message-ID: <200707240710.l6O7AUu24090@pillette.com>
Permalink:  ../200707240710.l6O7AUu24090@pillette.com/
Also on:    postgresql.org/message-id/200707240710.l6O7AUu24090@pillette.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andrew@pillette.com, valgog@gmail.com
  Subject: Re: multicolumn index column order
  In-Reply-To: <200707240710.l6O7AUu24090@pillette.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox