Re: index on user defined type

From: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: index on user defined type
Date: 2005-01-13 02:12:35
Message-ID: 1105582355.2886.396.camel@jeff
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2005-01-12 at 18:12 -0500, Tom Lane wrote:
> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> > I'm wondering if the function under = is an SQL function being inlined.
>
> Bingo --- that's surely it. After inlining, the expression would no
> longer look like it matched the index.
>
> You don't want to use SQL functions to define indexable operators
> anyway. They leak memory, and are slow, and neither of those are
> good properties for an index support function.
>
> regards, tom lane

Thanks very much guys. I got confused and tried to simplify it to a
simple test case and confused myself more when it still didn't work.
Just to be sure I redid it in plpgsql with no problems.

I understand that index operations should be written in C for production
use, or at least tested in C to see if it helps matters. Comparison
operators are of course very simple to write in any language anyway.

I attached a proposed documentation patch. I wasn't able to readily see
the implications of writing a function in SQL regarding an index, so
perhaps this will help someone in the future (not that many people will
attempt writing index access methods in SQL, but someone could get
confused like I did).

Regards,
Jeff Davis

Attachment Content-Type Size
create_opclass.sgml.patch text/x-patch 968 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Tillotson 2005-01-13 03:01:16 Re: Postgresql Text field / Visual FoxPro Memo and ODBC
Previous Message Josué Maldonado 2005-01-12 23:37:39 Re: Postgresql Text field / Visual FoxPro Memo and ODBC