Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 85A0A2E0152 for ; Wed, 13 Feb 2008 16:34:03 -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 82989-09 for ; Wed, 13 Feb 2008 16:33:53 -0400 (AST) Received: from outmail137074.authsmtp.com (outmail137074.authsmtp.com [62.13.137.74]) by postgresql.org (Postfix) with ESMTP id BB8822E014A for ; Wed, 13 Feb 2008 16:33:53 -0400 (AST) Received: from outmail128181.authsmtp.net (outmail128181.authsmtp.net [62.13.128.181]) by punt4.authsmtp.com (8.14.1/8.14.1/Kp) with ESMTP id m1DKWmaT014421; Wed, 13 Feb 2008 20:32:48 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 m1DKXZ9Z038556; Wed, 13 Feb 2008 20:33:35 GMT Subject: Re: JDBC, prepared queries, and partitioning From: Simon Riggs To: Kris Jurka Cc: Josh Berkus , PostgreSQL - JDBC In-Reply-To: References: <200802131005.30553.josh@agliodbs.com> Content-Type: text/plain Date: Wed, 13 Feb 2008 20:34:24 +0000 Message-Id: <1202934864.16770.486.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Server-Quench: f33d182f-da72-11dc-9670-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFaQZba1xT HGQLW1xEUl17WmB/ aA8fZQBDYEtPQQZr TkxLXVBXCwUmXB11 fXZ0W3NydA1DfXg+ ZEVlWj4NX0cudE5/ FFMARGoEeGZhPDMC WUZfdx5UcAJLdhoR aVd4ByJDAzANdhEa MyUYCngTER90bGxN WAwVJEgfTQ4SAzMm Rh0ZWX0mG0FNXywp Mx06K1kaHUAeWicA 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/53 X-Sequence-Number: 18260 On Wed, 2008-02-13 at 13:51 -0500, Kris Jurka wrote: > > On Wed, 13 Feb 2008, Josh Berkus wrote: > > > Since JDBC always prepares and plan-caches queries, it makes it hard to use > > partitioning with a database connected to a JDBC connection pool; successive > > queries in the same session will select the wrong partition, or scan the > > whole partition set. > > > > It will never scan the wrong partition. It will always scan all > partitions. The server is smart enough to not generate a plan that is not > valid for only one parameter set. > > 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? -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com