Nab some low-hanging fruit: replace the planner's base_rel_list and
Tom Lane <tgl@sss.pgh.pa.us>
Nab some low-hanging fruit: replace the planner's base_rel_list and other_rel_list with a single array indexed by rangetable index. This reduces find_base_rel from O(N) to O(1) without any real penalty. While find_base_rel isn't one of the major bottlenecks in any profile I've seen so far, it was starting to creep up on the radar screen for complex queries --- so might as well fix it.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/nodes/outfuncs.c | modified | +2 −3 |
| src/backend/optimizer/path/allpaths.c | modified | +48 −12 |
| src/backend/optimizer/plan/planmain.c | modified | +7 −4 |
| src/backend/optimizer/util/relnode.c | modified | +71 −83 |
| src/include/nodes/relation.h | modified | +14 −7 |