Re: composite type array and index

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Marek Lewczuk" <newsy(at)lewczuk(dot)com>
Cc: "Lista dyskusyjna pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: composite type array and index
Date: 2007-05-24 14:25:35
Message-ID: b42b73150705240725i2d16b975ob33769e8d03bcd46@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/24/07, Marek Lewczuk <newsy(at)lewczuk(dot)com> wrote:
> Hello everyone,
> it's great to have in next release (8.3) great feature: composite type
> array. I'm waiting to see how it works, however I wonder whether it will
> be possible to create an index on a column of composite type array just
> like we have an index on integer[] column (using gin or intarray module) ?

good question. one small point here. you can index int[] with
standard btree and not gist which optimizes equality searches, etc.
The problem is not the array but that composite types have no defined
comparison function.

You can create an index on table with composite array type but it's
not really any use because the operator class is not defined for the
type. Array orderings decompose to orderings on the internal type.
If you really need the functionality you can create an operator class
for btree (for simple operations) or gist (for more complex searches
inside the array), gin, etc.

I guess it would be kinda nice if composite types had a 'operator of
last resort' which would work as the sql-row comparison does, and do
ordering left to right for purposes of comparison.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Célestin HELLEU 2007-05-24 14:30:19 Very big transaction in a stored procedure : how can i commit in the middle of it ?
Previous Message bruce 2007-05-24 14:02:15 postgres access - pg_hba.conf