Re: Foreign join pushdown vs EvalPlanQual - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: Foreign join pushdown vs EvalPlanQual
Date
Msg-id 55E82025.7010404@lab.ntt.co.jp
Whole thread Raw
In response to Re: Foreign join pushdown vs EvalPlanQual  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Responses Re: Foreign join pushdown vs EvalPlanQual  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Re: Foreign join pushdown vs EvalPlanQual  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 2015/09/03 14:22, Etsuro Fujita wrote:
> On 2015/09/03 9:41, Robert Haas wrote:
>> That having been said, I don't entirely like Fujita-san's patch
>> either.  Much of the new code is called immediately adjacent to an FDW
>> callback which could pretty trivially do the same thing itself, if
>> needed.

> Another idea about that code is to call that code in eg, ExecProcNode,
> instead of calling ExecForeignScan there.  I think that that might be
> much cleaner and resolve the naming problem below.

I gave it another thought; the following changes to ExecInitNode would 
make the patch much simpler, ie, we would no longer need to call the new 
code in ExecInitForeignScan, ExecForeignScan, ExecEndForeignScan, and 
ExecReScanForeignScan.  I think that would resolve the name problem also.

*** a/src/backend/executor/execProcnode.c
--- b/src/backend/executor/execProcnode.c
***************
*** 247,254 **** ExecInitNode(Plan *node, EState *estate, int eflags)            break;
        case T_ForeignScan:
!           result = (PlanState *) ExecInitForeignScan((ForeignScan *) node,
!                                                      estate, eflags);            break;
        case T_CustomScan:
--- 247,269 ----            break;
        case T_ForeignScan:
!           {
!               Index       scanrelid = ((ForeignScan *) 
node)->scan.scanrelid;
!
!               if (estate->es_epqTuple != NULL && scanrelid == 0)
!               {
!                   /*
!                    * We are in foreign join inside an EvalPlanQual 
recheck.
!                    * Initialize local join execution plan, instead.
!                    */
!                   Plan       *subplan = ((ForeignScan *) 
node)->fs_subplan;
!
!                   result = ExecInitNode(subplan, estate, eflags);
!               }
!               else
!                   result = (PlanState *) 
ExecInitForeignScan((ForeignScan *) node,
!                                                              estate, 
eflags);
!           }            break;

Best regards,
Etsuro Fujita




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Parallel Seq Scan
Next
From: Andres Freund
Date:
Subject: Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members