Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8A58E634148 for ; Thu, 7 May 2009 05:43:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 94323-08 for ; Thu, 7 May 2009 05:43:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128096.authsmtp.co.uk (outmail128096.authsmtp.co.uk [62.13.128.96]) by mail.postgresql.org (Postfix) with ESMTP id D456F634A53 for ; Thu, 7 May 2009 05:43:53 -0300 (ADT) Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt5.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n478hbWQ093715; Thu, 7 May 2009 09:43:37 +0100 (BST) Received: from [192.168.0.2] (85-211-67-243.dyn.gotadsl.co.uk [85.211.67.243]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n478haPN032874; Thu, 7 May 2009 09:43:36 +0100 (BST) Subject: Re: Very strange performance decrease when reusing a PreparedStatement From: Simon Riggs To: Tom Lane Cc: Roland Roberts , pgsql-jdbc@postgresql.org In-Reply-To: <29597.1241649548@sss.pgh.pa.us> References: <5C2E1645-73B6-4509-96CD-FA77869516AB@noopsis.fr> <49F71EDD.2070200@opencloud.com> <02437794-A78D-449C-843F-B823195F9623@noopsis.fr> <491f66a50905030310j5b4cdcd8jbf4f6e757c2ba580@mail.gmail.com> <49FDEB97.6050800@astrofoto.org> <1241647194.6109.52.camel@ebony.2ndQuadrant> <29597.1241649548@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 07 May 2009 09:45:51 +0100 Message-Id: <1241685951.6109.70.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 27bd5f56-3ae3-11de-8a51-002264978518 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFaAJbYFhI HGQLW11EUFR7XWB/ aAwfZQBDYEtPQQNt TkpNQU1QEQdtHhxP WBoZWkEjF3tGe3x4 YkIsX3dSVAp4chQp RxhRE3AFNDJjdWEe BBVFf1JRcR5Kfh1H bFR2U3sIYG1JBC9q VzwRExoaCH1hJT5E ChoRN1sUTktDBjMm SRcYGDwpFkBNSyg4 NREvMVNUA0YcNA0o PEY6WFQXexZwazVE EllEGiJVHEUIWycu AAVGNV9p X-Authentic-SMTP: 61633235383639.pelican.dmpriest.net.uk:1562/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL=0.057 X-Spam-Level: X-Archive-Number: 200905/45 X-Sequence-Number: 19595 On Wed, 2009-05-06 at 18:39 -0400, Tom Lane wrote: > Simon Riggs writes: > > We talked a few years back about an "Option node" that would select > > sub-plans at runtime based upon the actual values of the bind variable. > > Nobody's got around to doing anything with that yet. > > There is an AlternativeSubPlan mechanism in 8.4, though we're not doing > very much with it yet. OK, good. We just need to use it when the distribution of values is highly non-uniform such that values with max and min selectivity can generate different plans *and* we have a parameter, the arrival distribution of which we have no way of knowing at plan time. That case accounts for about 50% of the cases for which hints/special handling is currently required. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support