Skip site navigation (1) Skip section navigation (2)

Re: JDBC, prepared queries, and partitioning

From: Kris Jurka <books(at)ejurka(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL - JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC, prepared queries, and partitioning
Date: 2008-02-13 20:43:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Wed, 13 Feb 2008, Simon Riggs wrote:

> 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?

I'm not sure what your question is, you might be asking:

1) Do I need to be aware of prepare threshold with V2 connections?

No, prepareThreshold only affects V3 protocol connections.  Prior to the 
8.0 release there was rudimentary support for converting 
PreparedStatements to SQL level PREPARE/EXECUTE that worked with V2, but 
that was ripped out in the major 8.0 rewrite and V2 always interpolates 
parameters into the query and executes it directly.

2) Can't I use prepare threshold with V3 instead of switching to V2 and 
achieve the same effect?

No, in V3 all prepared statements are prepared regardless of the 
threshold.  The difference is in the level of "preparedness" by using 
either a named or unnamed statement at the protocol level.  See my 
previous email for more details on that topic.

Kris Jurka

In response to


pgsql-jdbc by date

Next:From: Tom LaneDate: 2008-02-13 20:47:34
Subject: Re: JDBC, prepared queries, and partitioning
Previous:From: Simon RiggsDate: 2008-02-13 20:34:24
Subject: Re: JDBC, prepared queries, and partitioning

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group