Re: Optimizing prepared statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing prepared statements
Date: 2006-09-03 16:52:21
Message-ID: 14008.1157302341@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Jeroen T. Vermeulen" <jtv(at)xs4all(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mdean 2006-09-03 17:07:11 Re: [GENERAL] Thought provoking piece on NetBSD
Previous Message Jeroen T. Vermeulen 2006-09-03 16:49:37 Re: Optimizing prepared statements