Parallel query for subplan/sublink.

This commit is contained in:
TotaJ
2020-12-07 11:47:38 +08:00
parent 8f0c2915f8
commit 381e9c5485
10 changed files with 189 additions and 50 deletions

View File

@ -1072,10 +1072,10 @@ static void set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel, RangeT
break;
case RTE_VALUES:
/*
* The data for a VALUES clause is stored in the plan tree itself,
* so scanning it in a worker is fine.
*/
/* Check for parallel-restricted functions. */
if (has_parallel_hazard((Node *)rte->values_lists, false)) {
return;
}
break;
case RTE_CTE:
@ -1102,6 +1102,14 @@ static void set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel, RangeT
if (has_parallel_hazard((Node *)rel->baserestrictinfo, false))
return;
/*
* Likewise, if the relation's outputs are not parallel-safe, give up.
* (Usually, they're just Vars, but sometimes they're not.)
*/
if (has_parallel_hazard((Node *)rel->reltargetlist, false)) {
return;
}
/* We have a winner. */
rel->consider_parallel = true;
}