Re: Optimizing prepared statements - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Optimizing prepared statements
Date
Msg-id 14008.1157302341@sss.pgh.pa.us
Whole thread Raw
In response to Re: Optimizing prepared statements  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
Responses Re: Optimizing prepared statements  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
List pgsql-hackers
"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


pgsql-hackers by date:

Previous
From: "Jeroen T. Vermeulen"
Date:
Subject: Re: Optimizing prepared statements
Next
From: Tom Lane
Date:
Subject: @ versus ~, redux