Re: index is not used

From: mila boldareva <pierro(at)dds(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: index is not used
Date: 2002-08-21 08:07:36
Message-ID: 43164924839.20020821100736@dds.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


> mila boldareva <pierro(at)dds(dot)nl> writes:
>> But the indices are not used, even when I added a separate index on
>> field1 !

> Have you run ANALYZE (or VACUUM ANALYZE) on that table?

> regards, tom lane

Yes, VACUUM [full] alone did not help, but, as advised (thanks!), I've
VACUUM ANALYZEd, and then it started using index on integer field1 and
field2 as expected, but the index on real field3 is used only when I
ask ordering, and a query like below remains seq. scan:

trc=# explain select * from mytable where field3 = 0.1 limit 1;
NOTICE: QUERY PLAN:

Limit (cost=0.00..11.25 rows=1 width=12)
-> Seq Scan on mytable (cost=0.00..182277.74 rows=16201 width=12)

EXPLAIN
trc=#

Thilo Hille suggested that postgres uses sequential scans for queries
when a huge number of affected rows is expected, but it uses seq.scan
even when I ask for a value that is definitely out the range of values
I have.

Anyway, thanks for help,
Mila

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message sol 2002-08-21 08:08:23 Re: Installing PostgreSQL
Previous Message rdkurth 2002-08-21 04:02:16 problem with Connection refused