summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2005-03-25 21:58:00 +0000
committerTom Lane2005-03-25 21:58:00 +0000
commitadb1a6e95b2087e44c845edc15c28a87f5ba7ac1 (patch)
tree262134a0f4ec11fe71f1963d4531b71f2534aea3 /src/include
parent08890b407e976e4871f2024ed5a3071d0fa510a6 (diff)
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.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/pg_constraint.h4
-rw-r--r--src/include/commands/trigger.h4
-rw-r--r--src/include/executor/instrument.h4
-rw-r--r--src/include/nodes/execnodes.h4
4 files changed, 10 insertions, 6 deletions
diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h
index 3231f4b7788..fdc8c0676da 100644
--- a/src/include/catalog/pg_constraint.h
+++ b/src/include/catalog/pg_constraint.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.14 2004/12/31 22:03:24 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.15 2005/03/25 21:57:59 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -181,4 +181,6 @@ extern char *ChooseConstraintName(const char *name1, const char *name2,
const char *label, Oid namespace,
List *others);
+extern char *GetConstraintNameForTrigger(Oid triggerId);
+
#endif /* PG_CONSTRAINT_H */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 1f84b0eaa9a..1aacccc8110 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.51 2004/12/31 22:03:28 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.52 2005/03/25 21:57:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -156,7 +156,7 @@ extern void ExecARUpdateTriggers(EState *estate,
extern void AfterTriggerBeginXact(void);
extern void AfterTriggerBeginQuery(void);
-extern void AfterTriggerEndQuery(void);
+extern void AfterTriggerEndQuery(EState *estate);
extern void AfterTriggerEndXact(void);
extern void AfterTriggerAbortXact(void);
extern void AfterTriggerBeginSubXact(void);
diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h
index 8936c5cce23..0540fd0da71 100644
--- a/src/include/executor/instrument.h
+++ b/src/include/executor/instrument.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.9 2005/03/20 22:27:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.10 2005/03/25 21:57:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,7 +70,7 @@ typedef struct Instrumentation
double nloops; /* # of run cycles for this node */
} Instrumentation;
-extern Instrumentation *InstrAlloc(void);
+extern Instrumentation *InstrAlloc(int n);
extern void InstrStartNode(Instrumentation *instr);
extern void InstrStopNode(Instrumentation *instr, bool returnedTuple);
extern void InstrEndLoop(Instrumentation *instr);
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 8e5404b5078..da82daaac98 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.124 2005/03/16 21:38:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.125 2005/03/25 21:58:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -261,6 +261,7 @@ typedef struct JunkFilter
* IndexRelationInfo array of key/attr info for indices
* TrigDesc triggers to be fired, if any
* TrigFunctions cached lookup info for trigger functions
+ * TrigInstrument optional runtime measurements for triggers
* ConstraintExprs array of constraint-checking expr states
* junkFilter for removing junk attributes from tuples
* ----------------
@@ -275,6 +276,7 @@ typedef struct ResultRelInfo
IndexInfo **ri_IndexRelationInfo;
TriggerDesc *ri_TrigDesc;
FmgrInfo *ri_TrigFunctions;
+ struct Instrumentation *ri_TrigInstrument;
List **ri_ConstraintExprs;
JunkFilter *ri_junkFilter;
} ResultRelInfo;