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

From Dmitry Dolgov
Subject Re: why partition pruning doesn't work?
Date
Msg-id CA+q6zcVeHsvhqt+mZOax2njJe9cpoYAyfXNAYsRQ54ecJ+1gxw@mail.gmail.com
Whole thread Raw
In response to Re: why partition pruning doesn't work?  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: why partition pruning doesn't work?
List pgsql-hackers
> On 5 June 2018 at 12:31, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>
> doesn't look quite right.  What says expr is really a Param?  The patch
> appears to work because, by setting pinfo->execparams to *something*, it
> triggers execution-time pruning to run; its contents aren't necessarily
> used during execution pruning.  In fact, it would've crashed if the
> execution-time pruning code had required execparams to contain *valid*
> param id, but currently it doesn't.
>
> What I think we'd need to do to make this work is to make execution-time
> pruning be invoked even if there aren't any Params involved.  IOW, let's
> try to teach make_partition_pruneinfo that it can go ahead also in the
> cases where there are expressions being compared with the partition key
> that contain (only) stable functions.  Then, go and fix the
> execution-pruning code to not *always* expect there to be Params to prune
> with.

Yeah, I agree - I copied this approach mindlessly from the original hacky
patch. So, looks like it's necessary to have something like got_stable_expr
together with gotparam. And after that the only place where I see Params
are in use is partkey_datum_from_expr where all the stuff is actually
evaluated. So apparently this part about "fix the execution-pruning code to not
*always* expect there to be Params to prune with" will be only about this
function - am I correct or there is something else that I missed?


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Spilling hashed SetOps and aggregates to disk
Next
From: Andres Freund
Date:
Subject: Re: Spilling hashed SetOps and aggregates to disk