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 <[EMAIL PROTECTED]> LW7 EQI Argentina
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend