Thread: pgsql: Add a Gather executor node.

pgsql: Add a Gather executor node.

From
Robert Haas
Date:
Add a Gather executor node.

A Gather executor node runs any number of copies of a plan in an equal
number of workers and merges all of the results into a single tuple
stream.  It can also run the plan itself, if the workers are
unavailable or haven't started up yet.  It is intended to work with
the Partial Seq Scan node which will be added in future commits.

It could also be used to implement parallel query of a different sort
by itself, without help from Partial Seq Scan, if the single_copy mode
is used.  In that mode, a worker executes the plan, and the parallel
leader does not, merely collecting the worker's results.  So, a Gather
node could be inserted into a plan to split the execution of that plan
across two processes.  Nested Gather nodes aren't currently supported,
but we might want to add support for that in the future.

There's nothing in the planner to actually generate Gather nodes yet,
so it's not quite time to break out the champagne.  But we're getting
close.

Amit Kapila.  Some designs suggestions were provided by me, and I also
reviewed the patch.  Single-copy mode, documentation, and other minor
changes also by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3bd909b220930f21d6e15833a17947be749e7fde

Modified Files
--------------
doc/src/sgml/config.sgml                      |   46 ++++
src/backend/commands/explain.c                |   19 ++
src/backend/executor/Makefile                 |    4 +-
src/backend/executor/execAmi.c                |    8 +
src/backend/executor/execMain.c               |    3 +
src/backend/executor/execParallel.c           |   14 +-
src/backend/executor/execProcnode.c           |   46 ++++
src/backend/executor/nodeGather.c             |  299 +++++++++++++++++++++++++
src/backend/nodes/copyfuncs.c                 |   25 +++
src/backend/nodes/outfuncs.c                  |   14 ++
src/backend/optimizer/path/costsize.c         |   38 ++++
src/backend/optimizer/plan/createplan.c       |   57 +++++
src/backend/optimizer/plan/setrefs.c          |    1 +
src/backend/optimizer/plan/subselect.c        |    1 +
src/backend/optimizer/util/pathnode.c         |   26 +++
src/backend/utils/misc/guc.c                  |   30 +++
src/backend/utils/misc/postgresql.conf.sample |    3 +
src/include/executor/executor.h               |    1 +
src/include/executor/nodeGather.h             |   25 +++
src/include/nodes/execnodes.h                 |   16 ++
src/include/nodes/nodes.h                     |    3 +
src/include/nodes/plannodes.h                 |   11 +
src/include/nodes/relation.h                  |   13 ++
src/include/optimizer/cost.h                  |    7 +
src/include/optimizer/pathnode.h              |    3 +
src/tools/pgindent/typedefs.list              |    4 +
26 files changed, 709 insertions(+), 8 deletions(-)


Re: [COMMITTERS] pgsql: Add a Gather executor node.

From
Andres Freund
Date:
Hi,

On 2015-09-30 23:29:30 +0000, Robert Haas wrote:
> Add a Gather executor node.
> ...
> src/backend/executor/execProcnode.c           |   46 ++++

I just noticed that this added a new execProcnode dispatch routine, but
didn't add that to the file's header

 *     INTERFACE ROUTINES
 *        ExecInitNode    -        initialize a plan node and its subplans
 *        ExecProcNode    -        get a tuple by executing the plan node
 *        ExecEndNode        -        shut down a plan node and its subplans
 *

Greetings,

Andres Freund