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

From Jeroen T. Vermeulen
Subject Re: Prepared statements considered harmful
Date
Msg-id 23335.125.24.240.23.1157124367.squirrel@webmail.xs4all.nl
Whole thread Raw
In response to Re: Prepared statements considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, September 1, 2006 21:30, Tom Lane wrote:

> Yeah.  One of the reasons the planner is acceptably fast is that it is
> aggressive about discarding candidate plans as soon as they are clearly
> inferior to other plans.  Tracking multiple plans that might be optimal
> under varying assumptions about the query parameters would make things
> exponentially slower.

AFAICS the planner shouldn't be affected at all--it'd just be invoked more
often as and when the need for new plans became apparent.  Not
"exponentially" (that's an overused word anyway) but "proportionally" to
that.

I've been assuming that once you have a plan, storing it is not very
expensive.  If, say, doubling the number of plans stored with a session's
prepared statements incurs some serious cost (apart from the planning
itself, of course) then that changes things.


Jeroen




pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Prepared statements considered harmful
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Prepared statements considered harmful