Index not being used ?

From: Carlos G Mendioroz <tron(at)huapi(dot)ba(dot)ar>
To: pgsql-general(at)postgresql(dot)org
Subject: Index not being used ?
Date: 2003-09-02 13:08:27
Message-ID: 3F54964B.5070301@huapi.ba.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm trying to understand why a perfect match index is not being used,
and a sequence scan is done in place:

PostgreSQL 7.3.4 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2
20020927 (prerelease)

I've a table with 7M records, and an index on 3 fields:

CREATE TABLE public.base (
nombre varchar(255),
calle varchar(255),
puerta int2,
resto varchar(255),
lid int2,
area varchar(4),
telefono varchar(10)
)
CREATE INDEX base_dir ON base USING btree (lid, calle, puerta);

And trying the following select:

select * from base where lid = 457 and calle = 'MALABIA' and puerta = 10

yields

Seq Scan on base (cost=100000000.00..100212801.12 rows=1 width=63)
Filter: ((lid = 457) AND (calle = 'MALABIA'::character varying) AND
(puerta = 10))

even with enable_seqscan set to off, as you may have guessed.

What am I missing here ?
(There's another index on area and telefono which works as expected,
so it's not a LOCALE problem AFAIK).

--
Carlos G Mendioroz <tron(at)huapi(dot)ba(dot)ar> LW7 EQI Argentina

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-09-02 13:16:59 CPAN, P for postgresql [Re: LAST_DAY Function in Postgres]
Previous Message Amin Schoeib 2003-09-02 13:08:23 LAST_DAY Function in Postgres