X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B361752838 for ; Thu, 23 Jun 2005 11:19:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51242-05 for ; Thu, 23 Jun 2005 14:19:03 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id BC4E75285C for ; Thu, 23 Jun 2005 11:19:01 -0300 (ADT) Received: (qmail 8278 invoked by uid 500); 23 Jun 2005 14:18:54 -0000 Date: Thu, 23 Jun 2005 09:18:54 -0500 From: Bruno Wolff III To: Kurt De Grave Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: parameterized LIKE does not use index Message-ID: <20050623141854.GA7505@wolff.to> Mail-Followup-To: Bruno Wolff III , Kurt De Grave , Josh Berkus , pgsql-performance@postgresql.org References: <42BA73CE.4030909@student.kuleuven.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42BA73CE.4030909@student.kuleuven.ac.be> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/454 X-Sequence-Number: 13091 On Thu, Jun 23, 2005 at 10:33:18 +0200, Kurt De Grave wrote: > > Now it's tempting to dream of some mechanism that could make the > database consider > replanning the query automatically once it knows the parameter, or > choose from > a set of plans depending on the parameter. In this case the general plan > was about three orders > of magnitude slower than the specialized plan. But I guess this case is > not all that common > and the developer can work around it. I remember some discussion about delaying planning until the first actual query so that planning could use actual parameters to do the planning. If you really want to have it check the parameters every time, I think you will need to replan every time. I don't know if there is a way to save some of the prepare working while doing this.