ModifyTable, EXPLAIN ANALYZE and AFTER triggers

Started by Marko Tiikkajaabout 15 years ago2 messagesdocs
Jump to latest
#1Marko Tiikkaja
marko@joh.to

Hi,

The recent commit 09b49a8439fde63826f93f55430868cf2585644b claims:

+    Time spent firing triggers, if any, is charged to the Insert,
+    Update, or Delete node, and is also shown separately for each trigger.
+    Note, however, that deferred triggers will not be fired until end of
+    transaction and are thus not accounted for in the output of
+    <command>EXPLAIN ANALYZE</command>.

But that's only part of the truth; the ModifyTable nodes queue AFTER
triggers, but don't actually fire them. I remember there was some
discussion during 9.0's development about making the ModifyTable nodes
also count the time spent firing AFTER triggers, but I don't remember
what we decided back then. Meanwhile, I think this part in the
documentation needs a small clarification.

Regards,
Marko Tiikkaja

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Marko Tiikkaja (#1)
Re: ModifyTable, EXPLAIN ANALYZE and AFTER triggers

Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> writes:

The recent commit 09b49a8439fde63826f93f55430868cf2585644b claims:

+    Time spent firing triggers, if any, is charged to the Insert,
+    Update, or Delete node, and is also shown separately for each trigger.
+    Note, however, that deferred triggers will not be fired until end of
+    transaction and are thus not accounted for in the output of
+    <command>EXPLAIN ANALYZE</command>.

But that's only part of the truth; the ModifyTable nodes queue AFTER
triggers, but don't actually fire them. I remember there was some
discussion during 9.0's development about making the ModifyTable nodes
also count the time spent firing AFTER triggers, but I don't remember
what we decided back then. Meanwhile, I think this part in the
documentation needs a small clarification.

Oh, you're right --- I was thinking that the fireASTriggers call would
actually execute the triggers, but of course it only queues them.
Will fix.

regards, tom lane