Re: index not being used - Mailing list pgsql-general

From Doug Fields
Subject Re: index not being used
Date
Msg-id 5.1.0.14.2.20021214161335.0209c838@pop.pexicom.com
Whole thread Raw
In response to index not being used  (Reynard Hilman <reynardmh@lightsky.com>)
Responses Re: index not being used
List pgsql-general
You're missing an analyze step: (see below)

>here is the table structure:
>create table test_10million (
>id   int8,
>app_id  int8
>);
>
>< fill the table with 10 million record >
>
>create index test_10million_id on test_10million (id);

ANALYZE test_10million;

>this query always uses sequential scan:
>select * from test_10million where id = 123 and app_id = 100;

Now try

explain select * from test_10million where id = 123 and app_id = 100;

Cheers,

Doug



pgsql-general by date:

Previous
From: Reynard Hilman
Date:
Subject: index not being used
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: index not being used