Array index not used for query on first element? - Mailing list pgsql-general

From John D. Burger
Subject Array index not used for query on first element?
Date
Msg-id 6024B85A-44C5-4B07-A2E7-2D9F2D5C4179@mitre.org
Whole thread Raw
Responses Re: Array index not used for query on first element?
Re: Array index not used for query on first element?
List 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

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Re-partitioning huge schema
Next
From: "Rodrigo De León"
Date:
Subject: Re: Array index not used for query on first element?