1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Postpone generate_gather_paths for topmost scan/join rel.

Don't call generate_gather_paths for the topmost scan/join relation
when it is initially populated with paths.  Instead, do the work in
grouping_planner.  By itself, this gains nothing; in fact it loses
slightly because we end up calling set_cheapest() for the topmost
scan/join rel twice rather than once.  However, it paves the way for
a future commit which will postpone generate_gather_paths for the
topmost scan/join relation even further, allowing more accurate
costing of parallel paths.

Amit Kapila and Robert Haas.  Earlier versions of this patch (which
different substantially) were reviewed by Dilip Kumar, Amit
Khandekar, Marina Polyakova, and Ashutosh Bapat.
This commit is contained in:
Robert Haas
2018-03-12 16:45:15 -04:00
parent d7c19e62a8
commit 3f90ec8597
3 changed files with 42 additions and 14 deletions

View File

@ -1974,6 +1974,15 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
scanjoin_targets = scanjoin_targets_contain_srfs = NIL;
}
/*
* Generate Gather or Gather Merge paths for the topmost scan/join
* relation. Once that's done, we must re-determine which paths are
* cheapest. (The previously-cheapest path might even have been
* pfree'd!)
*/
generate_gather_paths(root, current_rel, false);
set_cheapest(current_rel);
/*
* Forcibly apply SRF-free scan/join target to all the Paths for the
* scan/join rel.