mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Allow plan nodes with initPlans to be considered parallel-safe.
If the plan itself is parallel-safe, and the initPlans are too, there's no reason anymore to prevent the plan from being marked parallel-safe. That restriction (dating to commitab77a5a45) was really a special case of the fact that we couldn't transmit subplans to parallel workers at all. We fixed that in commit5e6d8d2bband follow-ons, but this case never got addressed. We still forbid attaching initPlans to a Gather node that's inserted pursuant to debug_parallel_query = regress. That's because, when we hide the Gather from EXPLAIN output, we'd hide the initPlans too, causing cosmetic regression diffs. It seems inadvisable to kluge EXPLAIN to the extent required to make the output look the same, so just don't do it in that case. Along the way, this also takes care of some sloppiness about updating path costs to match when we move initplans from one place to another during createplan.c and setrefs.c. Since all the planning decisions are already made by that point, this is just cosmetic; but it seems good to keep EXPLAIN output consistent with where the initplans are. The diff in query_planner() might be worth remarking on. I found that one because after fixing things to allow parallel-safe initplans, one partition_prune test case changed plans (as shown in the patch) --- but only when debug_parallel_query was active. The reason proved to be that we only bothered to mark Result nodes as potentially parallel-safe when debug_parallel_query is on. This neglects the fact that parallel-safety may be of interest for a sub-query even though the Result itself doesn't parallelize. Discussion: https://postgr.es/m/1129530.1681317832@sss.pgh.pa.us
This commit is contained in:
@@ -28,6 +28,9 @@ extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr);
|
||||
extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual);
|
||||
extern void SS_identify_outer_params(PlannerInfo *root);
|
||||
extern void SS_charge_for_initplans(PlannerInfo *root, RelOptInfo *final_rel);
|
||||
extern void SS_compute_initplan_cost(List *init_plans,
|
||||
Cost *initplan_cost_p,
|
||||
bool *unsafe_initplans_p);
|
||||
extern void SS_attach_initplans(PlannerInfo *root, Plan *plan);
|
||||
extern void SS_finalize_plan(PlannerInfo *root, Plan *plan);
|
||||
extern Param *SS_make_initplan_output_param(PlannerInfo *root,
|
||||
|
||||
Reference in New Issue
Block a user