Re: WHERE vs ORDER BY vs LIMIT why not using the correct index?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WHERE vs ORDER BY vs LIMIT why not using the correct index?
Дата
Msg-id 21632.1199836837@sss.pgh.pa.us
обсуждение исходный текст
Ответ на WHERE vs ORDER BY vs LIMIT why not using the correct index?  ("D. Dante Lorenso" <dante@lorenso.com>)
Список pgsql-general
"D. Dante Lorenso" <dante@lorenso.com> writes:
> I don't understand why the ORDER BY condition would be affecting my
> WHERE criteria.  Shouldn't the ordering be done after the filter is
> first applied?

No, not necessarily.  The problem you've got is that the planner
thinks there are 1473 rows not 4 that have status = 'D', and that
affects the choice of plan.  Have you ANALYZEd this table lately?

You might need to push up the statistics target to get reasonable
stats for the very infrequent status values ...

            regards, tom lane

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

Предыдущее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: benchmarking update/insert and random record update
Следующее
От: Eric Davies
Дата:
Сообщение: Experiences with extensibility