Re: Prepared statements and suboptimal plans

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Prepared statements and suboptimal plans
Дата
Msg-id 20110921023615.GV12765@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: Prepared statements and suboptimal plans  (Royce Ausburn <royce.ml@inomial.com>)
Список pgsql-performance
* Royce Ausburn (royce.ml@inomial.com) wrote:
> > Tom just mentioned that 9.1 will be able to re-plan parameterized prepared statements, so this issue will go away.
Inthe mean time you can only really use the standard workaround of setting the prepare theshold to 0 to disable
server-sideprepare, so you can continue to use JDBC prepared statements and have the driver do the parameter
substitutionfor you. 
>
> Thanks Craig -- that trick helps a lot.

You might also be able to bump up work_mem by a fair bit to get PG to
use a hashagg instead of groupagg/sort, even though its estimate is way
off.  That's what I've done in the past for similar situations and it's
worked well.  I'd recommend increasing it for just this query and then
resetting it (assuming you don't just drop the connection, in which case
you don't need to reset it since a new connection will get the default).

    Thanks,

        Stephen

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Prepared statements and suboptimal plans
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Prepared statements and suboptimal plans