1
1
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2
- index 92969636b7..1e705c709f 100644
2
+ index 92969636b7..42446d4e93 100644
3
3
--- a/src/backend/commands/explain.c
4
4
+++ b/src/backend/commands/explain.c
5
5
@@ -46,6 +46,9 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
@@ -22,8 +22,26 @@ index 92969636b7..1e705c709f 100644
22
22
+
23
23
ExplainCloseGroup("Query", NULL, true, es);
24
24
}
25
-
26
- @@ -1523,6 +1530,24 @@ ExplainNode(PlanState *planstate, List *ancestors,
25
+
26
+ @@ -1041,6 +1048,17 @@ ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used)
27
+ return planstate_tree_walker(planstate, ExplainPreScanNode, rels_used);
28
+ }
29
+
30
+ + static bool
31
+ + we_need_to_sum_tuples(const Plan *plan)
32
+ + {
33
+ + if (plan->path_parallel_workers > 0 && (
34
+ + plan->parallel_aware || nodeTag(plan) == T_HashJoin ||
35
+ + nodeTag(plan) == T_MergeJoin ||
36
+ + nodeTag(plan) == T_NestLoop))
37
+ + return true;
38
+ + return false;
39
+ + }
40
+ +
41
+ /*
42
+ * ExplainNode -
43
+ * Appends a description of a plan tree to es->str
44
+ @@ -1523,6 +1541,24 @@ ExplainNode(PlanState *planstate, List *ancestors,
27
45
appendStringInfo(es->str,
28
46
" (actual rows=%.0f loops=%.0f)",
29
47
rows, nloops);
@@ -33,8 +51,8 @@ index 92969636b7..1e705c709f 100644
33
51
+ int wrkrs = 1;
34
52
+ double error = -1.;
35
53
+
36
- + if (planstate->worker_instrument && plan->parallel_aware )
37
- + wrkrs = planstate->worker_instrument->num_workers + 1 ;
54
+ + if (planstate->worker_instrument && we_need_to_sum_tuples( plan) )
55
+ + wrkrs + = planstate->worker_instrument->num_workers;
38
56
+
39
57
+ if (plan->predicted_cardinality > 0.)
40
58
+ {
@@ -859,7 +877,7 @@ index f8b79ec120..b5eda01907 100644
859
877
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString,
860
878
ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest);
861
879
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
862
- index 4b7703d478..490d67b098 100644
880
+ index 441e64eca9..484bca379a 100644
863
881
--- a/src/include/nodes/pathnodes.h
864
882
+++ b/src/include/nodes/pathnodes.h
865
883
@@ -710,6 +710,10 @@ typedef struct RelOptInfo
0 commit comments