"Jeroen T. Vermeulen" <jtv@xs4all.nl> writes:
> If multiple cached plans can be applied to a given call, we prefer the one
> that optimizes away the most parameters.
What exactly do you mean by "optimize away a parameter"? The way you
described the mechanism, there are no parameters that are "optimized
away", you've merely adjusted selectivity predictions using some assumed
values. Actually converting a parameter to a constant is a whole
'nother matter --- it allows constant-folding for example. But then you
*cannot* use the plan unless there's an exact match to the assumed
value. These two approaches provide very different tradeoffs of plan
quality vs plan specificity, so it makes me uncomfortable that you're
failing to clarify what you mean.
regards, tom lane