Unix Technical Forum

parameterized queries and prepareThreshold

This is a discussion on parameterized queries and prepareThreshold within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> I'm using version 8.2.3 with latest jdbc and noticed that certain queries take a very long time even though ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 12:36 AM
Gene
 
Posts: n/a
Default parameterized queries and prepareThreshold

I'm using version 8.2.3 with latest jdbc and noticed that certain
queries take a very
long time even though I have partial indexes that it should be using.
It uses them and performs very quickly if I hard code the constants
(no preparedStmt)
and do an explain.

I noticed this in the changelog and figured it was the problem but
wanted to make sure I wasn't on a wild goose chase:

"Protocol-level unnamed prepared statements are re-planned for each
set of BIND values (Tom) This improves performance because the exact
parameter values can be used in the plan."

I'm using hibernate and can't determine from the docs if what they use
are considered named/unnamed as stated in the docs above but i'm
guessing by the results they are (S_123/C_124).

LOG: duration: 23926.439 ms execute S_123/C_124: select ... PIV1 = ?
OR PIV2 = ? ...
DETAIL: parameters: $1 = 'PARTIALINDEXVALUE1', $2 = 'PARTIALINDEXVALUE2'

In hibernate this is my connection string:

<property name="hibernate.connection.driver_class">org.postg resql.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.Pos tgreSQLDialect</property>
<property name="hibernate.connection.url">
jdbcostgresql://192.168.106.191/isis?autoReconnect=true;prepareThreshold=0
</property>

can i verify somehow that the prepareThreshold parameter is making it
into the jdbc driver?

thanks for any help

--
Gene Hart

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 12:36 AM
Oliver Jowett
 
Posts: n/a
Default Re: parameterized queries and prepareThreshold

Gene wrote:

> jdbcostgresql://192.168.106.191/isis?autoReconnect=true;prepareThreshold=0


You need '&' not ';' in that URL.

-O

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com