diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-07-03 15:35:29 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-07-03 15:35:29 -0400 |
commit | 0e495c5e2f97aa7e2323705a6daed73cdd6c168c (patch) | |
tree | 62804fa1fd5e0ca8cb59579068e403e829a86e94 /src | |
parent | c89d507649df9fbc21617e02ab4d5e765a28b7df (diff) | |
download | postgresql-0e495c5e2f97aa7e2323705a6daed73cdd6c168c.tar.gz postgresql-0e495c5e2f97aa7e2323705a6daed73cdd6c168c.zip |
Set correct cost data in Gather node added by force_parallel_mode.
We were just leaving the cost fields zeroes, which produces obviously bogus
output with force_parallel_mode = on. With force_parallel_mode = regress,
the zeroes are hidden, but I wonder if they wouldn't still confuse add-on
code such as auto_explain.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/optimizer/plan/planner.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index ddf1109de76..796f564e4f8 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -343,7 +343,22 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams) gather->num_workers = 1; gather->single_copy = true; gather->invisible = (force_parallel_mode == FORCE_PARALLEL_REGRESS); + + /* + * Ideally we'd use cost_gather here, but setting up dummy path data + * to satisfy it doesn't seem much cleaner than knowing what it does. + */ + gather->plan.startup_cost = top_plan->startup_cost + + parallel_setup_cost; + gather->plan.total_cost = top_plan->total_cost + + parallel_setup_cost + parallel_tuple_cost * top_plan->plan_rows; + gather->plan.plan_rows = top_plan->plan_rows; + gather->plan.plan_width = top_plan->plan_width; + gather->plan.parallel_aware = false; + + /* use parallel mode for parallel plans. */ root->glob->parallelModeNeeded = true; + top_plan = &gather->plan; } |