Not using index - Mailing list pgsql-general

From Bas Scheffers
Subject Not using index
Date
Msg-id 10158.80.177.109.207.1076573638.squirrel@io.scheffers.net
Whole thread Raw
Responses Re: Not using index  (Shridhar Daithankar <shridhar@frodo.hserus.net>)
Re: Not using index  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
Hi,

I have a table with about 100K rows, on which I have created a btree index
of the type table_name(int, int, int, timestamp).

At first postgres was using it for my AND query on all four columns, but
after dropping it and creating different ones and testing, it suddenly
stopped using it. Vaccuuming, reindexing, recreating the table and even
recreating the database all didn't help.

Then I discovered "set enable_seqscan to off". It started using the index
again. This is certainly not a case of it not being beneficial to use the
index; using the index drops the query time from 260ms to 36ms!

In most references I have seen, setting enable_seqscan to off is something
only to be done for testing. But obviously if Postgres doesn't start
behaving properly, I can't go to production without it. Is this the case
or do many use this feature in production?

Can you give Postgres index hints like you can do in Oracle and Sybase?

Any clues?

Thanks,
Bas.

pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: I want to use postresql for this app, but...
Next
From: Shridhar Daithankar
Date:
Subject: Re: Not using index