From: | nolan(at)celery(dot)tssi(dot)com |
---|---|
To: | aayers(at)eldocomp(dot)com (Andrew Ayers) |
Cc: | pgsql-general(at)postgresql(dot)org (pgsql-general(at)postgresql(dot)org) |
Subject: | Re: Why does it not use the index? |
Date: | 2003-07-21 19:46:11 |
Message-ID: | 20030721194611.2019.qmail@celery.tssi.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jim C. Nasby | 2003-07-21 19:57:10 | Re: Billions of records? |
Previous Message | Philip Greer | 2003-07-21 19:33:22 | Re: Why does it not use the index? |