Re: index vs. seq scan choice?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: index vs. seq scan choice?
Дата
Msg-id 27828.1180055291@sss.pgh.pa.us
обсуждение исходный текст
Ответ на index vs. seq scan choice?  ("George Pavlov" <gpavlov@mynewplace.com>)
Ответы Re: index vs. seq scan choice?  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: index vs. seq scan choice?  ("George Pavlov" <gpavlov@mynewplace.com>)
Список pgsql-general
"George Pavlov" <gpavlov@mynewplace.com> writes:
> I am curious what could make the PA query to ignore the index. What are
> the specific stats that are being used to make this decision?

The frequency of the specific value being searched for, and the overall
order-correlation of the column.  Since the latter is not dependent on a
particular value, my guess at the reason for the inconsistent results is
that you don't have the column's statistics target set high enough to
track all the interesting values --- or maybe just not high enough to
acquire sufficiently accurate frequency estimates for them.  Take a look
at the pg_stats row for the column ...

(The default statistics target is 10, which is widely considered too
low --- you might find 100 more suitable.)

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: "Raymond C. Rodgers"
Дата:
Сообщение: Inheritance question
Следующее
От: Scott Ribe
Дата:
Сообщение: Uhm, so, yeah, speaking of /.