Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BAD402E019B for ; Thu, 14 Feb 2008 03:13:04 -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 02161-02 for ; Thu, 14 Feb 2008 03:13:00 -0400 (AST) Received: from outmail137072.authsmtp.net (outmail137072.authsmtp.net [62.13.137.72]) by postgresql.org (Postfix) with ESMTP id 8E6552E0176 for ; Thu, 14 Feb 2008 03:13:00 -0400 (AST) Received: from outmail128182.authsmtp.co.uk (outmail128182.authsmtp.co.uk [62.13.128.182]) by punt4.authsmtp.com (8.14.1/8.14.1/Kp) with ESMTP id m1E7BlGo048994; Thu, 14 Feb 2008 07:11:47 GMT Received: from [192.168.0.3] (85-211-31-42.dyn.gotadsl.co.uk [85.211.31.42]) (authenticated bits=0) by mail.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id m1E7CXDI056965; Thu, 14 Feb 2008 07:12:34 GMT Subject: Re: JDBC, prepared queries, and partitioning From: Simon Riggs To: Oliver Jowett Cc: josh@agliodbs.com, Stephen Denne , Kris Jurka , PostgreSQL - JDBC In-Reply-To: <47B37BDA.8020702@opencloud.com> References: <200802131005.30553.josh@agliodbs.com> <1202939756.16770.517.camel@ebony.site> <200802131423.24613.josh@agliodbs.com> <47B37549.3@opencloud.com> <1202944752.16770.568.camel@ebony.site> <47B37BDA.8020702@opencloud.com> Content-Type: text/plain Date: Thu, 14 Feb 2008 07:13:23 +0000 Message-Id: <1202973203.16770.581.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Server-Quench: 36e5fb10-dacc-11dc-9670-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksacxtFaQFba1xT HGQLW1xEUFp7WGF/ aA4fZQBDYEtPQQZr TkxLXVBXCwUmXB10 AW12JmBycgNPfns+ Z0ViXD5YWhF/IxR8 QlMARD5VeGZhPDMC WUZfdx5UcAJLdhoR aVd4ByJDAzANdhEa MyUYCngTER90bGxN WAwVJEgfTQ4SAzMm Rh0ZWX0mG0FNXywp Mx06K1kaHUAeWjY5 X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:787/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/84 X-Sequence-Number: 18291 On Thu, 2008-02-14 at 12:23 +1300, Oliver Jowett wrote: > Simon Riggs wrote: > > > What we need is a "send parameters inline" mode that can be set as an > > option for a PreparedStatement. Nobody wants to use V2, we just want the > > ability to re-plan a query every time. Perhaps that is best implemented > > as a server side option that can be exposed via JDBC option, since this > > is an SQL requirement and nothing to do with Java. > > Unfortunately you can't have your cake and eat it too. Many of the > features specific to V3 *require* that parameters be sent out of line > (e.g. parameter metadata, bytea streaming, possibly OUT parameters) > > As Kris said earlier in this thread what we really need is a way to tell > the server "I will only ever use this statement once, with these > particular parameter values, go ahead and optimize the plan on that basis" But V3 supports having no parameters at all right? All we have to do is create a new property called "reOptimize", whose default value is false. When reOptimize is true we - use the code from V2 to fold parameters inline - re-execute the protocol sequence for Parse/Bind/Execute just as if we have never seen this SQL statement before (with the parameters inline, we literally haven't) We have the code already for this, so no complex coding required. We can put in server side code for 8.4 to do this, as Tom suggests. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com