Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C1C6064FD78 for ; Wed, 31 Dec 2008 05:12:52 -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 18889-10 for ; Wed, 31 Dec 2008 05:12:49 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.154]) by mail.postgresql.org (Postfix) with ESMTP id 31C0F64FC71 for ; Wed, 31 Dec 2008 05:12:49 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 16so1908500fgg.23 for ; Wed, 31 Dec 2008 01:12:47 -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=7qWJhWoqJN/hHDuU+w+SMKkKoxNxAEnh/8cnCrfafTg=; b=C1+q1kJj3kiFnQ/WRyEKqMr2wnJEuXtc4HSMZZXRIxYcd9Xq5P0usZ7AdVo88xuHLU Sf1/nDyK2vbMjA+gyXAzctQUcJ22x0j+IkcFJ6gW2IxgzhzVtT1s8KUvOimtD4ohJM8l f/EfK7RBC1kf7AhiAnbh/hG4a6sMt+k8Kapgc= 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=VetzBX2vZxFkfhVN3MNY7eze82j914Y4GAtv+BiepwFPgW4Q/DB/T0vBpqcSq4GN0p gZrQnAmFU3tA1avXVqduqbKJ+fQ6RWrss7+C5ddh/w9nSIPQ98FtYejkG+i5o2vlhbfs PuabKHPxoylcuIIS2gu2xTOOaBFiKAsR3B5/E= Received: by 10.86.76.16 with SMTP id y16mr9253294fga.65.1230714767533; Wed, 31 Dec 2008 01:12:47 -0800 (PST) Received: by 10.86.78.15 with HTTP; Wed, 31 Dec 2008 01:12:47 -0800 (PST) Message-ID: <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com> Date: Wed, 31 Dec 2008 10:12:47 +0100 From: "Guillaume Smet" To: bricklen Subject: Re: Poor plan choice in prepared statement Cc: pgsql-performance@postgresql.org In-Reply-To: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <33b743250812301059u31ce82faw3d72a38280b37402@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/241 X-Sequence-Number: 32277 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