Re: index not being used

From: Doug Fields <dfields-pg-general(at)pexicom(dot)com>
To: Reynard Hilman <reynardmh(at)lightsky(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index not being used
Date: 2002-12-14 21:14:28
Message-ID: 5.1.0.14.2.20021214161335.0209c838@pop.pexicom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2002-12-14 21:43:17 Re: index not being used
Previous Message Reynard Hilman 2002-12-14 20:43:37 index not being used