Re: index is not used - Mailing list pgsql-novice

From mila boldareva
Subject Re: index is not used
Date
Msg-id 43164924839.20020821100736@dds.nl
Whole thread Raw
In response to Re: index is not used  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: index is not used  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
> mila boldareva <pierro@dds.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


pgsql-novice by date:

Previous
From: rdkurth@starband.net
Date:
Subject: problem with Connection refused
Next
From: sol
Date:
Subject: Re: Installing PostgreSQL