Re: strange query plan with LIMIT

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: strange query plan with LIMIT
Дата
Msg-id BANLkTi=iPiHELpnikeNM070+qyZVyiqbbw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: strange query plan with LIMIT  (anthony.shipman@symstream.com)
Список pgsql-performance
Hello

2011/6/8  <anthony.shipman@symstream.com>:
> On Wednesday 08 June 2011 18:39, Pavel Stehule wrote:
>> if you use FOR statement, there should be a problem in using a
>> implicit cursor - try to set a GUC cursor_tuple_fraction to 1.0.
> Alas this is mammoth replicator, equivalent to PG 8.3 and it doesn't have that
> parameter.

It should be a part of problem - resp. combination with bad statistic.
Maybe you should to rewrite your code to

DECLARE int i = 0;

FOR x IN EXECUTE '....'
LOOP
  RETURN NEXT ...
  i := i + 1;
  EXIT WHEN i > limitvar
END LOOP

Regards

Pavel Stehule



> --
> Anthony Shipman                 | It's caches all the way
> Anthony.Shipman@symstream.com   | down.
>

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

Предыдущее
От: tv@fuzzy.cz
Дата:
Сообщение: Re: strange query plan with LIMIT
Следующее
От: tv@fuzzy.cz
Дата:
Сообщение: Re: Set of related slow queries