Re: Why does it not use the index?

Поиск
Список
Период
Сортировка
От nolan@celery.tssi.com
Тема Re: Why does it not use the index?
Дата
Msg-id 20030721194611.2019.qmail@celery.tssi.com
обсуждение исходный текст
Ответ на Re: Why does it not use the index?  (Andrew Ayers <aayers@eldocomp.com>)
Список 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 по дате отправления:

Предыдущее
От: Philip Greer
Дата:
Сообщение: Re: Why does it not use the index?
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Billions of records?