diff options
Diffstat (limited to 'src/backend/optimizer/plan/planmain.c')
-rw-r--r-- | src/backend/optimizer/plan/planmain.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index 848df97013e..d73e7c0ab0f 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -20,6 +20,7 @@ */ #include "postgres.h" +#include "optimizer/clauses.h" #include "optimizer/orclauses.h" #include "optimizer/pathnode.h" #include "optimizer/paths.h" @@ -70,6 +71,17 @@ query_planner(PlannerInfo *root, List *tlist, /* We need a dummy joinrel to describe the empty set of baserels */ final_rel = build_empty_join_rel(root); + /* + * If query allows parallelism in general, check whether the quals + * are parallel-restricted. There's currently no real benefit to + * setting this flag correctly because we can't yet reference subplans + * from parallel workers. But that might change someday, so set this + * correctly anyway. + */ + if (root->glob->parallelModeOK) + final_rel->consider_parallel = + !has_parallel_hazard(parse->jointree->quals, false); + /* The only path for it is a trivial Result path */ add_path(final_rel, (Path *) create_result_path((List *) parse->jointree->quals)); |