From bd0ebac86591f21550e0ee140ad26ae9eee34209 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Mon, 29 Jan 2018 16:05:10 +0100 Subject: [PATCH] Skip call to ActiveReadableNodeList when there are no subplans --- src/backend/distributed/executor/subplan_execution.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/executor/subplan_execution.c b/src/backend/distributed/executor/subplan_execution.c index 5a3449dfe..72a5860a5 100644 --- a/src/backend/distributed/executor/subplan_execution.c +++ b/src/backend/distributed/executor/subplan_execution.c @@ -34,9 +34,17 @@ ExecuteSubPlans(DistributedPlan *distributedPlan) uint64 planId = distributedPlan->planId; List *subPlanList = distributedPlan->subPlanList; ListCell *subPlanCell = NULL; - List *nodeList = ActiveReadableNodeList(); + List *nodeList = NIL; bool writeLocalFile = false; + if (subPlanList == NIL) + { + /* no subplans to execute */ + return; + } + + nodeList = ActiveReadableNodeList(); + foreach(subPlanCell, subPlanList) { DistributedSubPlan *subPlan = (DistributedSubPlan *) lfirst(subPlanCell);