Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order
Дата
Msg-id 2399.1256528426@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Oct 25, 2009, at 10:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ...  The solution for the second
>> one is to also put LockRows underneath the Sort node, and to regard its
>> output as unsorted so that a Sort node will certainly be generated.
>> (This in turn implies that we should prefer the cheapest-total plan
>> for the rest of the query.)

> This seems like it could potentially introduce a performance  
> regression, but the current behavior is so bizarre that it seems like  
> we should still change it.

Yeah, it could definitely run slower than the existing code --- in
particular the combination of all three (FOR UPDATE ORDER BY LIMIT)
would tend to become a seqscan-and-sort rather than possibly just
reading one end of an index.  However, I quote the old aphorism that
it can be made indefinitely fast if it doesn't have to give the right
answer.  The reason the current behavior is fast is it's giving the
wrong answer :-(
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Parsing config files in a directory