Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0F1329FB323 for ; Tue, 26 Sep 2006 09:26:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 31809-10 for ; Tue, 26 Sep 2006 09:26:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 73D859FB322 for ; Tue, 26 Sep 2006 09:26:19 -0300 (ADT) Received: from 222-152-186-122.jetstream.xtra.co.nz ([222.152.186.122] helo=[10.1.1.3]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1GSC0t-0005YU-9n; Wed, 27 Sep 2006 00:26:15 +1200 Message-ID: <45191C65.3080705@opencloud.com> Date: Wed, 27 Sep 2006 00:26:13 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Markus Schaber CC: pgsql-jdbc@postgresql.org Subject: Re: Bind message References: <451846B0.6070906@logix-tt.com> <45184D61.3010007@opencloud.com> <4518E986.3030801@logix-tt.com> <4518FF16.3050804@opencloud.com> <4519166D.9040705@logix-tt.com> In-Reply-To: <4519166D.9040705@logix-tt.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/118 X-Sequence-Number: 15836 Markus Schaber wrote: > Hi, Oliver, > > Oliver Jowett wrote: >>Isn't this just a very roundabout way of overriding the planner? i.e. >>what you are really doing is saying "ignore your statistics, I know more >>about the parameter values I'm going to give you than I'm actually >>telling you".. > > > No, it's telling the planner "You can assume that all those queries for > my statement are similar enough that the same query plan will fit them, > so you can safe the overhead of both parsing and planning". What I mean is, if you are prepared to say that, what you are really wanting is to second-guess the planner and tell the server "use *THIS* plan" explicitly .. In both approaches, you (the app developer) need detailed knowledge about what sort of plans work for the parameters & query you are using (for your particular server version and dataset etc). Doing that at the Parse/Bind level doesn't seem right and in fact seems even more errorprone than explicitly specifying a plan, since you are relying on the planner picking a particular plan for a particular set of parameter values that you happened to use first which may or may not always be true depending on things like the current state of DB statistics.. -O