On Thu, 2007-09-27 at 10:40 -0400, Tom Lane wrote:
> And yet there's another trap here: if the parameter you passed in
> chanced to be one of the very common values, a plan that was optimized
> for a small number of matches would perform terribly.
I wonder could we move prepare_threshold onto the server? (from JDBC).
When we prepare a statement, we record the current setting of the
prepare_threshold parameter into the plan for that statement. Valid
settings are -1, 0 or more.
If the setting is -1 then we always re-plan the statement.
If the setting is 0 then we plan the statement generically.
If the setting is > 0 then we plan the statement according to the
specific parameter value and then decrement the prepare count, so
eventually the executions will hit 0 (above).
That would also simplify JDBC and allow the functionality from other
clients, as well as from within PLs.
We could also force the plan to be -1 when the planning involves
something that would force it to be a one-time plan, e.g. constraint
exclusion. (So we could then get rid of that parameter).
In response to
pgsql-performance by date
|Next:||From: Kevin Kempter||Date: 2007-09-27 17:42:06|
|Subject: Tuning for warm standby|
|Previous:||From: Csaba Nagy||Date: 2007-09-27 15:16:06|
|Subject: Re: Searching for the cause of a bad plan|