Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8964264FDF9 for ; Thu, 1 Jan 2009 09:44:56 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 40639-01 for ; Thu, 1 Jan 2009 09:44:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mail.postgresql.org (Postfix) with ESMTP id 8549C64FDF7 for ; Thu, 1 Jan 2009 09:44:53 -0400 (AST) Received: by bwz12 with SMTP id 12so16269953bwz.19 for ; Thu, 01 Jan 2009 05:44:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=mwzVusY7DxXfIuvzD35Vli9DsW+gIkl+LxTXQZV5jQg=; b=X55AS5PGV9P5CH5DvfQMVjoYerRIVewoSZ/B/PB0pvB3EcVllM3T8fa5B0o2NkyZUl dOhHNRzNBjwlnNIBfJ7QKdt5EX+gDEr0nddSlcTTUkMIJaWf8aIye0eB0IORTrWoGSXy YJ4Vmxn2aNyz6bI6wGnw48ThKtPCXgGHQEP1E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=FLKU/SMrN7bL87KkJNr39/oaVRraUKCyDLtCGsKNA7t2D0YAGAsYAu/mKM9kmb9Vs5 e7f3u5EdpLtUYAU/jZHaLsp+ievTTG81R2lAYYQSsEbnjnC9RjXkXEsUJi8l7CyKSrPE JFXoaOgsRNKk/0Z1X+75hT82XZfz5TbuWsdpE= Received: by 10.223.113.136 with SMTP id a8mr12191960faq.76.1230817490709; Thu, 01 Jan 2009 05:44:50 -0800 (PST) Received: by 10.223.107.134 with HTTP; Thu, 1 Jan 2009 05:44:50 -0800 (PST) Message-ID: <603c8f070901010544p53f01ae0x4920c6edf4c57a2c@mail.gmail.com> Date: Thu, 1 Jan 2009 08:44:50 -0500 From: "Robert Haas" To: "Alvaro Herrera" Subject: Re: Poor plan choice in prepared statement Cc: "Tom Lane" , "Scott Carey" , bricklen , "Scott Marlowe" , "Merlin Moncure" , "pgsql-performance@postgresql.org" In-Reply-To: <20081231160118.GE3809@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com> <2796.1230678149@sss.pgh.pa.us> <20081231160118.GE3809@alvh.no-ip.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200901/1 X-Sequence-Number: 32280 On Wed, Dec 31, 2008 at 11:01 AM, Alvaro Herrera wrote: >> The point of a prepared statement IMHO is to do the planning only once. >> There's necessarily a tradeoff between that and having a plan that's >> perfectly adapted to specific parameter values. > > I think it has been shown enough times that the performance drop caused > by a worse plan can be orders of magnitudes worse than what's gained by > producing the plan only once. It does not seem a bad idea to provide a > way to carry out only the parse phase, and postpone planning until the > parameters have been received. +1. ...Robert