Re: knngist - 0.8

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: knngist - 0.8
Date: 2010-10-17 01:54:57
Message-ID: AANLkTim9nACLt1yGbnB=Xyh6fA2DHvyY7pZ5dJd1hRNp@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 15, 2010 at 9:39 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Oct 15, 2010 at 8:45 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Fri, Oct 15, 2010 at 8:10 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> Perhaps we should think of pg_amop not so much
>>>> as a way to tell the AM what to do, but just a way to tell it what
>>>> operator is logically involved without relying on the name or OID.
>>>
>>> I already think of it that way ...
>>
>> OK.
>
> Thinking about it that way, perhaps we could add an integer column
> amop_whats_it_good_for that gets used as a bit field.  That wouldn't
> require changing the index structure, although it might break some
> other things.

I gave this a shot (though I called it amoppurpose rather than
amop_whats_it_good_for) and I think it's a reasonable way to proceed.
Proof-of-concept patch attached. This just adds the column (using the
existing padding space), defines AMOP_SEARCH and AMOP_ORDER, and makes
just about everything ignore anything not marked AMOP_SEARCH,
attached. This would obviously need some more hacking to pay
attention to AMOP_ORDER where relevant, etc. and to create some actual
syntax around it. Currently CREATE OPERATOR CLASS / ALTER OPERATOR
FAMILY have this bit:

OPERATOR strategy_number ( op_type [ , op_type ] )

knngist-0.9 implements this:

[ORDER] OPERATOR strategy_number ( op_type [, op_type ] )

...but with the design proposed above that's not quite what we'd want,
because amoppurpose is a bit field, so you could have one or both of
the two possible purposes. Perhaps:

OPERATOR strategy_number ( op_type [ , op_type ] ) [ FOR { SEARCH |
ORDER } [, ...] ]

With the default being FOR SEARCH.

Comments?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-10-17 01:56:51 Re: knngist - 0.8
Previous Message Tatsuo Ishii 2010-10-17 01:27:08 Re: How to reliably detect if it's a promoting standby