Re: Adding "LIMIT 1" kills performance.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Adding "LIMIT 1" kills performance.
Дата
Msg-id 1866.1212083951@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Adding "LIMIT 1" kills performance.  (Chris Shoemaker <chris.shoemaker@cox.net>)
Список pgsql-performance
Chris Shoemaker <chris.shoemaker@cox.net> writes:
> Still stumped,

The short answer here is that the planner is guessing that scanning the
index in ID order will come across the desired row (ie, the first one
matching the join condition) in less time than it will take to select
all the joinable rows, sort them by ID, and take the first one.  It's
wrong in this case, but the plan is not unreasonable on its face.
The problem boils down to a misestimate of how many join rows there are.
You might get better results by increasing the statistics targets.

There are plenty of similar cases in the list archives.

            regards, tom lane

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

Предыдущее
От: Chris Shoemaker
Дата:
Сообщение: Re: Adding "LIMIT 1" kills performance.
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: 2GB or not 2GB