pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Smet <guillaume.smet@gmail.com>
To: bricklen <bricklen@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Poor plan choice in prepared statement
Date: Wed, 31 Dec 2008 10:12:47 +0100
Message-ID: <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com> (raw)
In-Reply-To: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com>
References: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com>

On Tue, Dec 30, 2008 at 7:59 PM, bricklen <bricklen@gmail.com> 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



view thread (20+ messages)  latest in thread

Message-ID: <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com>
Permalink:  ../1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com/
Also on:    postgresql.org/message-id/1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: guillaume.smet@gmail.com, bricklen@gmail.com
  Subject: Re: Poor plan choice in prepared statement
  In-Reply-To: <1d4e0c10812310112h2e96001ap86a42e78803a18bc@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox