Re: Prepared statements considered harmful - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Prepared statements considered harmful
Date
Msg-id 20060901074829.GF12644@svana.org
Whole thread Raw
In response to Re: Prepared statements considered harmful  (Lukas Kahwe Smith <smith@pooteeweet.org>)
List pgsql-hackers
On Fri, Sep 01, 2006 at 09:26:24AM +0200, Lukas Kahwe Smith wrote:
> AFAIK since Oracle 9i planning is always deferred until the first
> execution. This way they hope to get a better plan, which would
> obviously not be possible if the selectivity varies greatly.

Interesting.

> So are the plans generated without taking any bound values into account
> more stable in performance (albeit at times slower than what would have
> been produced if the value would have been known)?

Possibly, though they might uniformly suck or be uniformly good...

> Either way mixing the question of when to prepare the plan with the
> prepared statement being named or unnamed seems unexpected.

Yes, well, when the V3 protocol designed it wasn't considered to
seperate the parse and plan phases. The exact commit that got us to
where we are now is here:

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/postgres.c#rev1.420

That was over two years ago, I'm not sure whether any of the ideas
mentioned in there have been implemented since.

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

pgsql-hackers by date:

Previous
From: "Zeugswetter Andreas DCP SD"
Date:
Subject: Re: Prepared statements considered harmful
Next
From: "Magnus Hagander"
Date:
Subject: Re: Win32 hard crash problem