Improve EXPLAIN ANALYZE to show the time spent in each trigger when
Tom Lane <tgl@sss.pgh.pa.us>
Improve EXPLAIN ANALYZE to show the time spent in each trigger when executing a statement that fires triggers. Formerly this time was included in "Total runtime" but not otherwise accounted for. As a side benefit, we avoid re-opening relations when firing non-deferred AFTER triggers, because the trigger code can re-use the main executor's ResultRelInfo data structure.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/perform.sgml | modified | +14 −11 |
| src/backend/catalog/pg_constraint.c | modified | +95 −1 |
| src/backend/commands/copy.c | modified | +6 −2 |
| src/backend/commands/explain.c | modified | +67 −6 |
| src/backend/commands/portalcmds.c | modified | +3 −3 |
| src/backend/commands/trigger.c | modified | +168 −94 |
| src/backend/executor/execMain.c | modified | +26 −6 |
| src/backend/executor/execProcnode.c | modified | +2 −2 |
| src/backend/executor/functions.c | modified | +2 −2 |
| src/backend/executor/instrument.c | modified | +5 −5 |
| src/backend/executor/spi.c | modified | +4 −4 |
| src/backend/tcop/pquery.c | modified | +4 −4 |
| src/include/catalog/pg_constraint.h | modified | +3 −1 |
| src/include/commands/trigger.h | modified | +2 −2 |
| src/include/executor/instrument.h | modified | +2 −2 |
| src/include/nodes/execnodes.h | modified | +3 −1 |