Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit110a6db

Browse files
committed
Allow RTE_SUBQUERY rels to be considered parallel-safe.
There isn't really any reason not to; the original comments here werepartly confused about subplans versus subquery-in-FROM, and partlydependent on restrictions that no longer apply now that subqueries returnPaths not Plans. Depending on what's inside the subquery, it might failto produce any parallel_safe Paths, but that's fine.Tom Lane and Robert Haas
1 parent4ea9948 commit110a6db

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎src/backend/optimizer/path/allpaths.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -575,15 +575,19 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
575575
caseRTE_SUBQUERY:
576576

577577
/*
578-
* Subplans currently aren't passed to workers. Even if they
579-
* were, the subplan might be using parallelism internally, and we
580-
* can't support nested Gather nodes at present. Finally, we
581-
* don't have a good way of knowing whether the subplan involves
582-
* any parallel-restricted operations. It would be nice to relax
583-
* this restriction some day, but it's going to take a fair amount
584-
* of work.
578+
* There's no intrinsic problem with scanning a subquery-in-FROM
579+
* (as distinct from a SubPlan or InitPlan) in a parallel worker.
580+
* If the subquery doesn't happen to have any parallel-safe paths,
581+
* then flagging it as consider_parallel won't change anything,
582+
* but that's true for plain tables, too. We must set
583+
* consider_parallel based on the rel's own quals and targetlist,
584+
* so that if a subquery path is parallel-safe but the quals and
585+
* projection we're sticking onto it are not, we correctly mark
586+
* the SubqueryScanPath as not parallel-safe. (Note that
587+
* set_subquery_pathlist() might push some of these quals down
588+
* into the subquery itself, but that doesn't change anything.)
585589
*/
586-
return;
590+
break;
587591

588592
caseRTE_JOIN:
589593
/* Shouldn't happen; we're only considering baserels here. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp