mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Speed up planner's scanning for parallel-query hazards.
We need to scan the whole parse tree for parallel-unsafe functions. If there are none, we'll later need to determine whether particular subtrees contain any parallel-restricted functions. The previous coding retained no knowledge from the first scan, even though this is very wasteful in the common case where the query contains only parallel-safe functions. We can bypass all of the later scans by remembering that fact. This provides a small but measurable speed improvement when the case applies, and shouldn't cost anything when it doesn't. Patch by me, reviewed by Robert Haas Discussion: <3740.1471538387@sss.pgh.pa.us>
This commit is contained in:
@ -513,8 +513,8 @@ build_join_rel(PlannerInfo *root,
|
||||
* here.
|
||||
*/
|
||||
if (inner_rel->consider_parallel && outer_rel->consider_parallel &&
|
||||
!has_parallel_hazard((Node *) restrictlist, false) &&
|
||||
!has_parallel_hazard((Node *) joinrel->reltarget->exprs, false))
|
||||
is_parallel_safe(root, (Node *) restrictlist) &&
|
||||
is_parallel_safe(root, (Node *) joinrel->reltarget->exprs))
|
||||
joinrel->consider_parallel = true;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user