Re: [JDBC] Query much slower when run from postgres function

Поиск
Список
Период
Сортировка
От Guillaume Smet
Тема Re: [JDBC] Query much slower when run from postgres function
Дата
Msg-id 1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query much slower when run from postgres function  (Guillaume Cottenceau <gc@mnc.ch>)
Ответы Re: [JDBC] Query much slower when run from postgres function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [JDBC] Query much slower when run from postgres function  (Scott Carey <scott@richrelevance.com>)
Список pgsql-performance
On Mon, Mar 9, 2009 at 5:51 PM, Guillaume Cottenceau <gc@mnc.ch> wrote:
> Until it's possible to specifically tell the JDBC driver (and/or
> PG?) to not plan once for all runs (or is there something better
> to think of?), or the whole thing would be more clever (off the
> top of my head, PG could try to replan with the first actual
> values - or first xx actual values - and if the plan is
> different, then flag that prepared statement for replanning each
> time if the overall time estimate is different enough), I've
> opted to tell the JDBC driver to use the protocol version 2, as
> prepared statements were not so much prepared back then (IIRC
> parameter interpolation is performed in driver and the whole SQL
> query is passed each time, parsed, and planned) using
> protocolVersion=2 in the JDBC URL. So far it worked very well for
> us.

Unnamed prepared statements are planned after binding the values,
starting with 8.3, or more precisely starting with 8.3.2 as early 8.3
versions were partially broken on this behalf.

It's not always possible to use protocol version 2 as it's quite
limited (especially considering the exceptions returned).

--
Guillaume

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

Предыдущее
От: Guillaume Cottenceau
Дата:
Сообщение: Re: Query much slower when run from postgres function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [JDBC] Query much slower when run from postgres function