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

Re: Indexes with descending date columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: theo(at)flame(dot)co(dot)za
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Indexes with descending date columns
Date: 2006-03-24 04:59:13
Message-ID: 27697.1143176353@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Theo Kramer <theo(at)flame(dot)co(dot)za> writes:
> If so, I would appreciate any pointers on where to start on this -
> already fumbling my way through Interfacing Extensions To Indexes in the
> manual...

Search the PG list archives for discussions of reverse-sort opclasses.
It's really pretty trivial, once you've created a negated btree
comparison function for the datatype.

This is the sort of thing that we are almost but not quite ready to put
into the standard distribution.  The issues that are bugging me have to
do with whether NULLs sort low or high --- right now, if you make a
reverse-sort opclass, it will effectively sort NULLs low instead of
high, and that has some unpleasant consequences because the rest of the
system isn't prepared for variance on the point (in particular I'm
afraid this could break mergejoins).  I'd like to see us make "NULLs
low" vs "NULLs high" be a defined property of opclasses, and deal with
the fallout from that, and then we could put reverse-sort opclasses for
all the standard datatypes into the regular distribution.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Jim C. NasbyDate: 2006-03-24 10:05:14
Subject: Re: WAL logging of SELECT ... INTO command
Previous:From: Theo KramerDate: 2006-03-24 04:32:29
Subject: Re: Indexes with descending date columns

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