Re: Array index not used for query on first element?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Array index not used for query on first element?
Date: 2007-12-08 01:11:42
Message-ID: 582.1197076302@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"John D. Burger" <john(at)mitre(dot)org> writes:
> It seemed reasonable to me that a select on the first element of an
> array column could use an index on the column, but, as seen in this
> example, I can't get it to do so:

Nope. The operators that go along with a btree index are equality,
less than, etc on the whole indexed column. btree knows nothing
about extracting array elements.

You might find that contrib/intarray would help, though the operators it
can index are not exactly "array[x] = y".

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-12-08 01:21:08 Re: Column pgl.transaction does not exist in 8.3 beta 4
Previous Message Tom Lane 2007-12-08 00:57:28 Re: Identifying casts