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 17475.1086916779@sss.pgh.pa.us
Whole thread Raw
In response to Re: Delaying the planning of unnamed statements until Bind  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Delaying the planning of unnamed statements until Bind
List pgsql-hackers
I've applied the patch you sent in for this, with some editorializations
--- you were being too aggressive about substituting constants, with the
net effect that the plan was not still parameterized as it was supposed
to be.

I realized along the way that what we're really doing here is inventing
a notion of constant-folding expressions "for estimation purposes only".
As such, we don't have to be as rigid about making only provably safe
transformations as eval_const_expressions normally has to be.  I didn't
do anything with the idea yet, but I'd like to look into having this
mode do more than just substitute Param values.  An example that's been
causing us trouble for a long while is that the planner can't make any
nondefault selectivity estimate forSELECT ... WHERE timestampcol > now() - '1 day';
because eval_const_expressions dare not reduce now() to current time.
But I think it would be entirely reasonable to do so "for estimation
purposes".
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Nested xacts: looking for testers and review
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: [COMMITTERS] pgsql-server: Clean up generation of default names