Re: The logic behind the prepared statement in PostgreSQL

Поиск
Список
Период
Сортировка
От Radosław Smogura
Тема Re: The logic behind the prepared statement in PostgreSQL
Дата
Msg-id 201010081112.37192.rsmogura@softperience.eu
обсуждение исходный текст
Ответ на Re: The logic behind the prepared statement in PostgreSQL  (louis <louis@ibms.sinica.edu.tw>)
Список pgsql-jdbc
Hi,

> I think it's because postgresql JDBC Driver has a default limit for the max
> number of preparedStatement, which is 4. Can anyone tell me where to
> adjuest this parameter?

This parameter 4 is associated with prepare threshold. It says how many times
the given prepared statement (as Java object) will be executed before it will
be compiled into true, server side prepared statement.

In many applications developers uses PreparedStatement class just to wrap
parameters, so compiling such statement in server side statement adds unneeded
overhead. After you execute such PS few times then it's compiled, and in logs
you will see EXECUTE S_1 or S_1/C_1.

PG JDBC driver doesn't have built in support for caching statements in any
way, so two statements with same SQL will be mapped to different statements in
database, even if that are called in scope of same connection.

If you would like to cache statements, currently most servers support this, by
wrapping original database objects.

Kind ragards,
Radosław Smogura
http://www.softperience.eu

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

Предыдущее
От: Radosław Smogura
Дата:
Сообщение: Re: The logic behind the prepared statement in PostgreSQL
Следующее
От: Thangalin
Дата:
Сообщение: PostgreSQL data types mapped Java classes for JDBC