Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DAECA64FD16 for ; Wed, 31 Dec 2008 11:11:22 -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 84316-04 for ; Wed, 31 Dec 2008 11:11:20 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f19.google.com (mail-gx0-f19.google.com [209.85.217.19]) by mail.postgresql.org (Postfix) with ESMTP id C0E9764FCC9 for ; Wed, 31 Dec 2008 11:11:19 -0400 (AST) Received: by gxk12 with SMTP id 12so4056488gxk.19 for ; Wed, 31 Dec 2008 07:11:17 -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=wcC1Eas6C81pXWoJ6szh3uHD6P/bVNafyxuHhnFUAgU=; b=Xp+AaV/BEHpooCmfklXvc7LDfDSXMTsNLLf7EMXZ58NmRwVzVsF8os7JZkmYbnEnf7 fBtpXYXbKUSQPqqXql0phfvQy6LopcytqiWK+SBSgyBAAUNd0xzv/T90IsFDLA3XKl4D VV1rY6AqBikGCz4tWZVMlKh4yuJRUcYPL77o8= 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=PKo+mHF7JuIpnBfzq+x4KMaICYvvkWvaRLA/BQLGwuRAtqy1R2AovlfNioAwltOZId S03Pl3NMcrTmRnqwNxObTRBSGnyKm/rLQClmiDkyuRvBSxmMhDvqDSwkoomBWjagdDUY hH+4aGDrijl4U288JN/tCOeUP3uSEZ/P+3lKo= Received: by 10.142.12.14 with SMTP id 14mr6532868wfl.290.1230736277297; Wed, 31 Dec 2008 07:11:17 -0800 (PST) Received: by 10.142.255.15 with HTTP; Wed, 31 Dec 2008 07:11:17 -0800 (PST) Message-ID: <33b743250812310711r6fb8fb1ydb72aee090d7bc06@mail.gmail.com> Date: Wed, 31 Dec 2008 07:11:17 -0800 From: bricklen To: "Guillaume Smet" Subject: Re: Poor plan choice in prepared statement Cc: pgsql-performance@postgresql.org In-Reply-To: <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com> <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com> 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: 200812/242 X-Sequence-Number: 32278 Hi Guillaume, On Wed, Dec 31, 2008 at 1:12 AM, Guillaume Smet wrote: > On Tue, Dec 30, 2008 at 7:59 PM, bricklen wrote: >> I would like to continue to use bind variables to prevent sql >> injection, but I'd like to force a plan re-parse for every single >> query (if necessary?) > > As far as I understand your problem, you don't care about using > prepared statements. > > If so, you can: > - either use pg_query_params(): > http://www.php.net/manual/en/function.pg-query-params.php > - or use an unnamed prepared statements when you don't want a prepared > statement if, for some reason, you really need to use prepared > statements in a few cases: you can specify an empty string as plan > name. The condition for this one is that you need to upgrade to a > recent version of 8.3 as postponed planning of unnamed prepared > statements is a new feature of 8.3 and was broken in 8.3.0 and 8.3.1. > > -- > Guillaume > I will look into the pg_query_params() function to see if it works for us. I don't think your second suggestion is going to work for us, since we are stuck on 8.2 for the foreseeable future. Thanks for the tips though, I appreciate it! Bricklen