Re: Avoiding bad prepared-statement plans.

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeroen Vermeulen <jtv(at)xs4all(dot)nl>, Greg Stark <gsstark(at)mit(dot)edu>, Bart Samwel <bart(at)samwel(dot)tk>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoiding bad prepared-statement plans.
Date: 2010-03-02 23:53:56
Message-ID: 201003022353.o22NruN14103@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dimitri Fontaine wrote:
> Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> > 1) People preparing statements to save on parse+plan time; and
> > 2) People preparing statements to get convenenient param placement.
> >
> > I suspect that most of (1) also want (2), but many of (2) don't care much
> > about (1) and are just preparing statements for sql-injection safety (param
> > placement), because they've been told to by someone, because their library
> > does it for them, etc.
> >
> > So: Would it be easier to handle control of replan vs no-replan at PREPARE
> > time? Or would that have very much the same protocol/pl change issues?
>
> http://www.postgresql.org/docs/8.4/static/libpq-exec.html#LIBPQ-EXEC-MAIN
>
> PQexecParams
>
> Submits a command to the server and waits for the result, with the
> ability to pass parameters separately from the SQL command text.
>
> So I think what you're talking about is already in there.

There are three levels, SQL, libpq, and the wire protocol. The wire
protocol offers this via unnamed statements. libpq offers it via
PQexecParams(). SQL does not, as far as I can tell.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-03-02 23:54:28 Re: Avoiding bad prepared-statement plans.
Previous Message Bruce Momjian 2010-03-02 23:44:16 Re: Re: Hot Standby query cancellation and Streaming Replication integration