Array index not used for query on first element?

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Array index not used for query on first element?
Date: 2007-12-07 21:12:30
Message-ID: 6024B85A-44C5-4B07-A2E7-2D9F2D5C4179@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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:

=> create temp table tempPaths (path int[] primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"temppaths_pkey" for table "temppaths"
CREATE TABLE

=> set enable_seqscan to off;
SET

=> explain select * from temppaths where path[1] = 43;
QUERY PLAN
------------------------------------------------------------------------
--
Seq Scan on temppaths (cost=100000000.00..100000022.50 rows=5
width=32)
Filter: ("path"[1] = 43)
(2 rows)

This is under 7.4. Is this different on less paleolithic versions of
PG, or is there some other issue?

Thanks.

- John Burger
MITRE

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2007-12-07 21:19:22 Re: Replication Monitoring
Previous Message Joshua D. Drake 2007-12-07 20:44:02 Re: Re-partitioning huge schema