> The attached patch allows EXPLAIN ANALYZE to break out the time spent in
> triggers when EXPLAINing a statement that can fire triggers. Formerly
> this time was included in "Total runtime" but not otherwise accounted
> for.
Very nice.
> An example is
>
> regression=# explain analyze delete from foo;
> QUERY PLAN
> --------------------------------------------------------------------------------------------------------
> Seq Scan on foo (cost=0.00..172.70 rows=11770 width=6) (actual time=0.063..86.650 rows=10000 loops=1)
> Trigger RI_ConstraintTrigger_60781: time=3899.609 calls=10000
> Total runtime: 4218.309 ms
> (3 rows)
Could we get plain EXPLAIN output as well:
regression=# explain analyze delete from foo;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Seq Scan on foo (cost=0.00..172.70 rows=11770 width=6)
Trigger RI_ConstraintTrigger_60781: calls=11770
(2 rows)
Also, have you considered statement level triggers?
Chris