Re: Index ot being used

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index ot being used
Дата
Msg-id 3643.1118696404@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Index ot being used  (Madison Kelly <linux@alteeve.com>)
Ответы Re: Index ot being used  (Madison Kelly <linux@alteeve.com>)
Список pgsql-performance
Madison Kelly <linux@alteeve.com> writes:
>    So the index obiously provides a major performance boost! I just need
> to figure out how to tell the planner how to use it...

Simple division shows that the planner's cost estimate ratio between the
seqscan and the indexscan (11956.84 vs 83171.78) is off by a factor of
more than 8 compared to reality (2018.996 vs 1700.459).  Also the cost of
the sort seems to be drastically underestimated.

I suspect this may be a combination of random_page_cost being too high
(since your test case, at least, is no doubt fully cached in RAM) and
cpu_operator_cost being too low.  I'm wondering if text comparisons
are really slow on your machine --- possibly due to strcoll being
inefficient in the locale you are using, which you didn't say.  That
would account for both the seqscan being slower than expected and the
sort taking a long time.

It'd be interesting to look at the actual runtimes of this seqscan vs
one that is doing a simple integer comparison over the same number of
rows (and, preferably, returning about the same number of rows as this).

            regards, tom lane

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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Index ot being used
Следующее
От: Madison Kelly
Дата:
Сообщение: Pseudo-Solved was: (Re: Index ot being used)