aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 85d980356b7..04f14c91787 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -48,6 +48,7 @@
#include "executor/execdebug.h"
#include "executor/nodeSubplan.h"
#include "foreign/fdwapi.h"
+#include "jit/jit.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "optimizer/clauses.h"
@@ -494,6 +495,21 @@ standard_ExecutorEnd(QueryDesc *queryDesc)
ExecEndPlan(queryDesc->planstate, estate);
+ /*
+ * If this process has done JIT, either merge stats into worker stats, or
+ * use this process' stats as the global stats if no parallelism was used
+ * / no workers did JIT.
+ */
+ if (estate->es_instrument && queryDesc->estate->es_jit)
+ {
+ if (queryDesc->estate->es_jit_combined_instr)
+ InstrJitAgg(queryDesc->estate->es_jit_combined_instr,
+ &queryDesc->estate->es_jit->instr);
+ else
+ queryDesc->estate->es_jit_combined_instr =
+ &queryDesc->estate->es_jit->instr;
+ }
+
/* do away with our snapshots */
UnregisterSnapshot(estate->es_snapshot);
UnregisterSnapshot(estate->es_crosscheck_snapshot);