Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 265502E0137 for ; Wed, 13 Feb 2008 16:43:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 87705-03 for ; Wed, 13 Feb 2008 16:43:48 -0400 (AST) Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 53BD92E0244 for ; Wed, 13 Feb 2008 16:43:48 -0400 (AST) Received: (qmail 17934 invoked by uid 1112); 13 Feb 2008 20:43:46 -0000 Date: Wed, 13 Feb 2008 15:43:46 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Simon Riggs cc: Josh Berkus , PostgreSQL - JDBC Subject: Re: JDBC, prepared queries, and partitioning In-Reply-To: <1202934864.16770.486.camel@ebony.site> Message-ID: References: <200802131005.30553.josh@agliodbs.com> <1202934864.16770.486.camel@ebony.site> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/54 X-Sequence-Number: 18261 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