]> granicus.if.org Git - postgresql/commit
Fix parallel query so it doesn't spoil row estimates above Gather.
authorRobert Haas <rhaas@postgresql.org>
Sat, 1 Apr 2017 01:01:20 +0000 (21:01 -0400)
committerRobert Haas <rhaas@postgresql.org>
Sat, 1 Apr 2017 01:01:20 +0000 (21:01 -0400)
commit7d8f6986b83c9a56f6ea11c959cdd8f52e1b543d
tree6b070e57792e42ab817c186eae8dcf60793ad658
parent2113ac4cbb12b815804e8873d761cade9ddf49b9
Fix parallel query so it doesn't spoil row estimates above Gather.

Commit 45be99f8cd5d606086e0a458c9c72910ba8a613d removed GatherPath's
num_workers field, but this is entirely bogus.  Normally, a path's
parallel_workers flag is supposed to indicate the number of workers
that it wants, and should be 0 for a non-partial path.  In that
commit, I mistakenly thought that GatherPath could also use that field
to indicate the number of workers that it would try to start, but
that's disastrous, because then it can propagate up to higher nodes in
the plan tree, which will then get incorrect rowcounts because the
parallel_workers flag is involved in computing those values.  Repair
by putting the separate field back.

Report by Tomas Vondra.  Patch by me, reviewed by Amit Kapila.

Discussion: http://postgr.es/m/f91b4a44-f739-04bd-c4b6-f135bd643669@2ndquadrant.com
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/util/pathnode.c
src/include/nodes/relation.h