Re: why partition pruning doesn't work? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: why partition pruning doesn't work?
Date
Msg-id 7142.1527868419@sss.pgh.pa.us
Whole thread Raw
In response to Re: why partition pruning doesn't work?  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: why partition pruning doesn't work?
Re: why partition pruning doesn't work?
List pgsql-hackers
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:
> I think the patch is right if we were to handle only SQLValueFunction,
> but the bigger picture here is that we aren't evaluating stable
> functions before run-time partition pruning happens. I was under the
> impression that the stable functions/expressions get evaluated and
> folded into a constant just before the execution begins since a stable
> function produces the same output for same input during one execution
> invocation. But I am not able to find where we do that and probably we
> don't do that at all.

We don't; there was a patch floating around to make that happen, but
it hasn't been updated lately.

I agree though that it seems strange to special-case SQLValueFunction
rather than any-stable-expression.  As long as the evaluation happens
at executor start (i.e. with the query's run-time snapshot) it should
be reasonable to simplify any stable expression.

It's worth questioning whether this is a bug fix or an improvement.
If the latter, it probably ought to wait for v12.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Rui DeSousa
Date:
Subject: Re: Possible optimisation: push down SORT and LIMIT nodes
Next
From: Ashutosh Bapat
Date:
Subject: Re: I'd like to discuss scaleout at PGCon