Re: Scan Keys

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Scan Keys
Date: 2006-07-05 20:02:30
Message-ID: 20060705200230.GA32513@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 05, 2006 at 12:00:05PM -0400, Greg Stark wrote:
>
> I'm a bit confused about how scan keys work. Is there any simple way given a
> list of Datums of the same type as the index tuple attributes to get all
> matching index entries? This is for a non-system index.

A scankey determines which values you want. It consists of a value and
an operator. Using that the index code returns tuples matching.

So if you want all values equal to 4, you pass '4' for the Datum and
the Equal strategy, with the operator as '='.

The info you need is in the operator class. In a sense you do need to
know the type of index you're scanning, not all indexes use the same
strategy numbers.

> But I want to do something more like what btree does inside btinsert where it
> knows that no cross-type functions could be necessary and the only function of
> interest is equality.

By the time the btree code gets involved, everything in the scankey
should already have been filled in. I don't beleive the code actually
checks if the operator is of the type you specify.

Hope this helps a bit,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

  • Scan Keys at 2006-07-05 16:00:05 from Greg Stark

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2006-07-05 21:02:15 Re: binds only for s,u,i,d?
Previous Message Andrew Dunstan 2006-07-05 19:40:41 Re: buildfarm stats