On Thu, Sep 24, 2015 at 12:00 AM, Robert Haas <robertmhaas@gmail.com> wrote: > > On Thu, Sep 3, 2015 at 6:21 AM, Amit Kapila <amit.kapila16@gmail.com> wrote: > > [ new patches ] > > > It looks to me like there would be trouble if an initPlan or subPlan > were kept below a Funnel, or as I guess we're going to call it, a > Gather node. That's because a SubPlan doesn't actually have a pointer > to the node tree for the sub-plan in it. It just has an index into > PlannedStmt.subplans. But create_parallel_worker_plannedstmt sets the > subplans list to NIL. So that's not gonna work. Now maybe there's no > way for an initPlan or a subPlan to creep down under the funnel, but I > don't immediately see what would prevent it. >
I think initPlan will work with the existing patches as we are always
executing it in master and then sending the result to workers. Refer
below code in funnel patch:
ExecFunnel()
{
..
+/*
+ * Evaluate the InitPlan and pass the PARAM_EXEC params, so that
+ * values can be shared with worker backend. This is different from
+ * the way InitPlans are evaluated (lazy evaluation) at other places
+ * as instead of sharing the InitPlan to all the workers and let them
+ * execute, we pass the values which can be directly used by worker