Re: best way to fetch next/prev record based on index - Mailing list pgsql-performance

From Greg Stark
Subject Re: best way to fetch next/prev record based on index
Date
Msg-id 877jsmr90c.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: best way to fetch next/prev record based on index  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
List pgsql-performance
"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:

> Well, if and when the rowtype comparison can be made to work over multi
> part keys (and the optimizer is made to do tricks there), postgres can
> be made to give much better generalized ISAM access.  In the meantime,
> I'll just troubleshoot specific cases via application specific behavior
> as they come up.  In any case, many thanks to Greg and Tom for taking
> the time to pick this apart.

Well I'm not sure whether you caught it, but Tom did come up with a
work-around that works with the current infrastructure if all the columns
involved are the same datatype.

You can create a regular btree index on the expression array[a,b,c] and then
do your lookup using array[a,b,c] > array[a1,b1,c1].

This will only work in 7.4, not previous releases, for several reasons.

--
greg

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Optimizer refuses to hash join
Next
From: "Merlin Moncure"
Date:
Subject: Re: best way to fetch next/prev record based on index