]> granicus.if.org Git - postgresql/commit
Add a Gather Merge executor node.
authorRobert Haas <rhaas@postgresql.org>
Thu, 9 Mar 2017 12:40:36 +0000 (07:40 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 9 Mar 2017 12:49:29 +0000 (07:49 -0500)
commit355d3993c53ed62c5b53d020648e4fbcfbf5f155
tree9a439084995c6553dd035fe218d9864011192b36
parenta72f0365db4168e7d720608fe3ac0ca3fe9355df
Add a Gather Merge executor node.

Like Gather, we spawn multiple workers and run the same plan in each
one; however, Gather Merge is used when each worker produces the same
output ordering and we want to preserve that output ordering while
merging together the streams of tuples from various workers.  (In a
way, Gather Merge is like a hybrid of Gather and MergeAppend.)

This works out to a win if it saves us from having to perform an
expensive Sort.  In cases where only a small amount of data would need
to be sorted, it may actually be faster to use a regular Gather node
and then sort the results afterward, because Gather Merge sometimes
needs to wait synchronously for tuples whereas a pure Gather generally
doesn't.  But if this avoids an expensive sort then it's a win.

Rushabh Lathia, reviewed and tested by Amit Kapila, Thomas Munro,
and Neha Sharma, and reviewed and revised by me.

Discussion: http://postgr.es/m/CAGPqQf09oPX-cQRpBKS0Gq49Z+m6KBxgxd_p9gX8CKk_d75HoQ@mail.gmail.com
27 files changed:
doc/src/sgml/config.sgml
src/backend/commands/explain.c
src/backend/executor/Makefile
src/backend/executor/execProcnode.c
src/backend/executor/nodeGatherMerge.c [new file with mode: 0644]
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/util/pathnode.c
src/backend/utils/misc/guc.c
src/include/executor/nodeGatherMerge.h [new file with mode: 0644]
src/include/nodes/execnodes.h
src/include/nodes/nodes.h
src/include/nodes/plannodes.h
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/pathnode.h
src/test/regress/expected/select_parallel.out
src/test/regress/expected/sysviews.out
src/test/regress/sql/select_parallel.sql
src/tools/pgindent/typedefs.list