Re: JDBC, prepared queries, and partitioning

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: JDBC, prepared queries, and partitioning
Дата
Msg-id 23221.1202935654@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: JDBC, prepared queries, and partitioning  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: JDBC, prepared queries, and partitioning  (Simon Riggs <simon@2ndquadrant.com>)
Список pgsql-jdbc
Simon Riggs <simon@2ndquadrant.com> writes:
> On Wed, 2008-02-13 at 13:51 -0500, Kris Jurka wrote:
>> Using protocol version 2 will not prepare queries so constraint exclusion
>> can be used.  Just append protocolVersion=2 to your URL.

> What about the prepare threshold?

Won't help; the problem is that the planner will never consider a Param
value as a true constant.  So if you're trying to use out-of-line params
to avoid quoting/escaping/SQL-injection-risk issues, you're shut out of
constraint exclusion, as well as some other cases such as LIKE
optimization.

We could imagine having a different operating mode where a generated
plan is only used once and so the Param values can be taken as true
constants.

I suppose this could be implemented with a GUC variable rather than an
explicit protocol change, but I'm not sure if that'd be a good idea or
not.  It's not entirely clear to me which layers on the client side need
to be aware of such behavior.

            regards, tom lane

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: JDBC, prepared queries, and partitioning
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: JDBC, prepared queries, and partitioning