From: bricklen <bricklen@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Poor plan choice in prepared statement
Date: Tue, 30 Dec 2008 15:11:47 -0800
Message-ID: <33b743250812301511x30f1b377uf55fdca82d243c37@mail.gmail.com> (raw)
In-Reply-To: <2796.1230678149@sss.pgh.pa.us>
References: <33b743250812301059u31ce82faw3d72a38280b37402@mail.gmail.com>
<b42b73150812301142w4483978ahfb819b0313150dbb@mail.gmail.com>
<dcc563d10812301209i59bf612eidc42fa408d4441ab@mail.gmail.com>
<33b743250812301214k7a0ec4fby614d693ec7915d3@mail.gmail.com>
<BDFBB77C9E07BE4A984DAAE981D19F961ACD5F388E@EXVMBX018-1.exch018.msoutlookonline.net>
<2796.1230678149@sss.pgh.pa.us>
Hi Tom,
On Tue, Dec 30, 2008 at 3:02 PM, Tom Lane <tgl@sss.pgh.pa.us> 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 agree, and normally it wouldn't be an issue. In this particular
case, we are seeing response time to go from sub-second with
non-prepared queries, to over 200 seconds w/ prepared queries. Note
that is not an isolated case in our application, merely the numbers
from this particular example.
>
> Reasonable client-side APIs should provide the option to use out-of-line
> parameters, which is what you want to prevent SQL injection, without
> hard-wiring that to the orthogonal concept of statements whose plan is
> prepared in advance. In libpq, for instance, PQexecParams() does that.
>
> regards, tom lane
>
Again, I agree completely. What I am after I guess are some pointers
on where to look for that, with regards to PHP. Whatever I turn up, I
will turn over to our developers, but before I do that I want to be
sure I am giving them the correct advice.
Thanks,
Bricklen
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: bricklen@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: Poor plan choice in prepared statement
In-Reply-To: <33b743250812301511x30f1b377uf55fdca82d243c37@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