Speed up planner's scanning for parallel-query hazards.
Tom Lane <tgl@sss.pgh.pa.us>
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>
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/nodes/outfuncs.c | modified | +1 −0 |
| src/backend/optimizer/path/allpaths.c | modified | +4 −26 |
| src/backend/optimizer/plan/planmain.c | modified | +4 −5 |
| src/backend/optimizer/plan/planner.c | modified | +29 −14 |
| src/backend/optimizer/util/clauses.c | modified | +86 −29 |
| src/backend/optimizer/util/pathnode.c | modified | +3 −3 |
| src/backend/optimizer/util/relnode.c | modified | +2 −2 |
| src/include/nodes/relation.h | modified | +2 −0 |
| src/include/optimizer/clauses.h | modified | +2 −1 |