aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/execMain.c9
-rw-r--r--src/backend/executor/execUtils.c1
-rw-r--r--src/include/nodes/execnodes.h5
3 files changed, 13 insertions, 2 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 1b007dc32cd..eaf6f31a154 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -289,7 +289,8 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
* There is no return value, but output tuples (if any) are sent to
* the destination receiver specified in the QueryDesc; and the number
* of tuples processed at the top level can be found in
- * estate->es_processed.
+ * estate->es_processed. The total number of tuples processed in all
+ * the ExecutorRun calls can be found in estate->es_total_processed.
*
* We provide a function hook variable that lets loadable plugins
* get control when ExecutorRun is called. Such a plugin would
@@ -373,6 +374,12 @@ standard_ExecutorRun(QueryDesc *queryDesc,
}
/*
+ * Update es_total_processed to keep track of the number of tuples
+ * processed across multiple ExecutorRun() calls.
+ */
+ estate->es_total_processed += estate->es_processed;
+
+ /*
* shutdown tuple receiver, if we started it
*/
if (sendTuples)
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 012dbb69653..5ce8a0831b1 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -147,6 +147,7 @@ CreateExecutorState(void)
estate->es_tupleTable = NIL;
estate->es_processed = 0;
+ estate->es_total_processed = 0;
estate->es_top_eflags = 0;
estate->es_instrument = 0;
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index b0def732ca6..695ff056ba8 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -661,7 +661,10 @@ typedef struct EState
List *es_tupleTable; /* List of TupleTableSlots */
- uint64 es_processed; /* # of tuples processed */
+ uint64 es_processed; /* # of tuples processed during one
+ * ExecutorRun() call. */
+ uint64 es_total_processed; /* total # of tuples aggregated across all
+ * ExecutorRun() calls. */
int es_top_eflags; /* eflags passed to ExecutorStart */
int es_instrument; /* OR of InstrumentOption flags */