Re: Why does it not use the index? - Mailing list pgsql-general

From nolan@celery.tssi.com
Subject Re: Why does it not use the index?
Date
Msg-id 20030721194611.2019.qmail@celery.tssi.com
Whole thread Raw
In response to Re: Why does it not use the index?  (Andrew Ayers <aayers@eldocomp.com>)
List pgsql-general
> So - are you saying that if you have a table, and you create an index on
> that table, you need to perform an ANALYZE in order for PG to use the
> index. Otherwise, the index goes unused (or used improperly)?

it is easy enough to demonstrate that creating an index will result
in immediate improvements in query times.  The internals wizards would
have to answer the question as to whether 'create index' also creates
the initial stats on that index, though.  (If it doesn't, maybe that
should be a configuration option.)

However, you do need the stats to take best advantage of the index over
time and a wide range of queries, so regularly scheduled 'vacuum analyze's
are desirable.

What I don't know is whether there is a way pass along hints to the
optimizer or to write a query to FORCE it to use an index on some part
of a query despite what the optimizer decides.
--
Mike Nolan

pgsql-general by date:

Previous
From: Philip Greer
Date:
Subject: Re: Why does it not use the index?
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Billions of records?