Re: composite type array and index - Mailing list pgsql-general

From Merlin Moncure
Subject Re: composite type array and index
Date
Msg-id b42b73150705240725i2d16b975ob33769e8d03bcd46@mail.gmail.com
Whole thread Raw
In response to composite type array and index  (Marek Lewczuk <newsy@lewczuk.com>)
List pgsql-general
On 5/24/07, Marek Lewczuk <newsy@lewczuk.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

pgsql-general by date:

Previous
From: "btober"
Date:
Subject: Re: Geographic data sources, queries and questions
Next
From: Célestin HELLEU
Date:
Subject: Very big transaction in a stored procedure : how can i commit in the middle of it ?