Re: prepared statement performance

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: prepared statement performance
Дата
Msg-id 3B4A5A79.1060601@xythos.com
обсуждение исходный текст
Ответ на prepared statement performance  (Sheer El-Showk <sheer@saraf.com>)
Список pgsql-jdbc
Sheer,

If your code only runs against PostgreSQL, then the answer is that it
wouldn't be worth your time.  The FE/BE protocol that the postgres JDBC
driver uses doesn't support binding variables, so the JDBC driver ends
up doing exactly what you are currently doing in your code, and builds
up a single string from all the values and sends the result to the
server.  If your code also runs against other databases (for example
Oracle) then you could expect to see performance improvements as other
databases may (Oracle does) cache statements and rebind/reexecute.

thanks,
--Barry

Sheer El-Showk wrote:

> Does anyone have some handy metrics of the performance advantage of
> prepared vs unprepared statements?  I'm considering the case of an
> application which has to make multiple queries/inserts (30-100) per
> application transaction and which is currenlty generating the sql by
> building the strings on the fly then passing them to the JDBC.  Can I
> expect significant (ie worth the recoding time) performance increases by
> converting the statements into prepared statements?
>
> Thanks,
> Sheer
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>



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

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Too much data received?
Следующее
От: Steve Wampler
Дата:
Сообщение: Re: Too much data received?