]> granicus.if.org Git - postgresql/commit
Stop the executor if no more tuples can be sent from worker to leader.
authorRobert Haas <rhaas@postgresql.org>
Mon, 6 Jun 2016 18:52:58 +0000 (14:52 -0400)
committerRobert Haas <rhaas@postgresql.org>
Mon, 6 Jun 2016 18:52:58 +0000 (14:52 -0400)
commitc6dbf1fe79287291bc260cbc06b0de419d2a198c
tree8edc5d8f7d13201c73d90f0c217f6e00a27e5099
parent44339b892a04e94bbb472235882dc6f7023bdc65
Stop the executor if no more tuples can be sent from worker to leader.

If a Gather node has read as many tuples as it needs (for example, due
to Limit) it may detach the queue connecting it to the worker before
reading all of the worker's tuples.  Rather than let the worker
continue to generate and send all of the results, have it stop after
sending the next tuple.

More could be done here to stop the worker even quicker, but this is
about as well as we can hope to do for 9.6.

This is in response to a problem report from Andreas Seltenreich.
Commit 44339b892a04e94bbb472235882dc6f7023bdc65 should be actually be
sufficient to fix that example even without this change, but it seems
better to do this, too, since we might otherwise waste quite a large
amount of effort in one or more workers.

Discussion: CAA4eK1KOKGqmz9bGu+Z42qhRwMbm4R5rfnqsLCNqFs9j14jzEA@mail.gmail.com

Amit Kapila
14 files changed:
src/backend/access/common/printtup.c
src/backend/commands/copy.c
src/backend/commands/createas.c
src/backend/commands/matview.c
src/backend/executor/execMain.c
src/backend/executor/execTuples.c
src/backend/executor/functions.c
src/backend/executor/spi.c
src/backend/executor/tqueue.c
src/backend/executor/tstoreReceiver.c
src/backend/tcop/dest.c
src/backend/tcop/pquery.c
src/include/access/printtup.h
src/include/tcop/dest.h