Skip site navigation (1) Skip section navigation (2)

Re: Prepared statements considered harmful

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prepared statements considered harmful
Date: 2006-08-31 12:09:09
Message-ID: 20060831120909.GB27851@svana.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Thu, Aug 31, 2006 at 01:56:29PM +0200, Peter Eisentraut wrote:
> With time, it becomes ever clearer to me that prepared SQL statements are just 
> a really bad idea.  On some days, it seems like half the performance problems 
> in PostgreSQL-using systems are because a bad plan was cached somewhere.  I'd 
> say, in the majority of cases the time you save parsing and planning is 
> irrelevant compared to the possibly disastrous effects of wrong or suboptimal 
> plans.  I wonder if other people have similar experiences.

Yeah, it seems to me that many of the benefits of not planning are
overrun by the effects of bad plans.

> - Redefine "prepared" to mean "parsed" rather than "parsed and planned".

I think this is the best. Some way to specify that you don't want
planning to take place immediately would be good.

One question though: there is a function PQexecParams(). Does this
suffer from the same problem? I imagine most interfaces like
out-of-band parameters (no escaping issues), why do they not use this?

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

pgsql-hackers by date

Next:From: Csaba NagyDate: 2006-08-31 12:11:19
Subject: Re: Prepared statements considered harmful
Previous:From: Peter EisentrautDate: 2006-08-31 11:56:29
Subject: Prepared statements considered harmful

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group