Re: Prepared statements considered harmful

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Lukas Kahwe Smith <smith(at)pooteeweet(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prepared statements considered harmful
Date: 2006-09-01 07:48:29
Message-ID: 20060901074829.GF12644@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(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

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-09-01 07:59:44 Re: Win32 hard crash problem
Previous Message Zeugswetter Andreas DCP SD 2006-09-01 07:38:41 Re: Prepared statements considered harmful