Re: Delaying the planning of unnamed statements until Bind - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Delaying the planning of unnamed statements until Bind
Date
Msg-id 3464.1085189153@sss.pgh.pa.us
Whole thread Raw
In response to Re: Delaying the planning of unnamed statements until Bind  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Delaying the planning of unnamed statements until Bind
List pgsql-hackers
Oliver Jowett <oliver@opencloud.com> writes:
> This leads to my next problem (which was one of the original reasons I 
> went with node replacement): don't we get different performance between 
> a parameterized query and an equivalent unparameterized query in cases 
> such as this? :

>    SELECT * FROM sometable WHERE field = $1 * 10

I don't think the run-time performance would be materially different in
most cases.  What might happen is that if the selectivity functions are
stupid, they would fail to reduce the comparison value to a constant and
thus not be able to arrive at a good selectivity estimate, thus leading
to a bad plan choice.  However we need not put up with the selectivity
functions being that stupid.  I think it would be reasonable to
constant-fold expressions involving known parameter values *within the
context of selfuncs.c only*.  This would let us get good estimates
without giving up the usability of the plan for fresh parameter values.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Delaying the planning of unnamed statements until Bind
Next
From: Oliver Jowett
Date:
Subject: Re: Delaying the planning of unnamed statements until Bind