Re: Index scan troubles

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: Markus Wanner <markus(at)bluegap(dot)ch>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Index scan troubles
Date: 2008-09-02 17:17:10
Message-ID: 87y72aqxgp.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Markus Wanner <markus(at)bluegap(dot)ch> writes:

> Hi,
>
> I'm having a hard time using an index scan. So far, I've done quite well with
> ScanKeyInit for equality searches. But now I need to scan an index from a given
> starting point. Something like:
>
> (x, y, z,...) > (const, const, const,...)
>
> For the equality operatior, I've used get_sort_group_operators() in combination
> with get_opcode() to pass that on as the sk_func of the scan key. I slowly
> begin to doubt if that's correct at all.

It's right for your equality case which is effectively x=const, y=const,
z=const. It's not for row comparisons case for which you need a funny "header"
ScanKey. See the comments in access/skey.h, search for "row comparisons". I'm
not sure if there's a function to create this for you or if you have to do it
yourself. Search for other places where SK_ROW_HEADER appears.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's On-Demand Production Tuning

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-09-02 17:36:20 Re: WIP patch: Collation support
Previous Message Devrim GÜNDÜZ 2008-09-02 17:16:25 Re: What is d2mdir?