Skip site navigation (1) Skip section navigation (2)

WIP: make EXPLAIN ANALYZE show time spent in triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-patches(at)postgreSQL(dot)org
Subject: WIP: make EXPLAIN ANALYZE show time spent in triggers
Date: 2005-03-25 06:39:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
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

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)

The trigger display text probably still needs some work --- in
particular I'm wondering if RI triggers couldn't be displayed in some
more intelligent fashion than just the internal trigger name.

What I'm actually more interested in right now is comments on the
infrastructure changes.  To make this work, I modified the executor's
ResultRelInfo structs to include provisions to store per-trigger
Instrumentation nodes, and changed AfterTriggerEndQuery to receive the
query's EState in which it could look up the ResultRelInfos.  A nifty
side benefit is that the after-event trigger code doesn't have to open
result relations for itself anymore for non-deferred triggers: it can
use the executor's main copies of the relations.  I had to change the
call order so that AfterTriggerEndQuery is called before instead of
after ExecutorEnd (because ExecutorEnd closes down all this state).
I don't see any downside to that, but am I missing something?

			regards, tom lane


pgsql-patches by date

Next:From: Christopher Kings-LynneDate: 2005-03-25 06:48:51
Subject: Re: WIP: make EXPLAIN ANALYZE show time spent in triggers
Previous:From: Christopher Kings-LynneDate: 2005-03-25 05:45:37
Subject: Update psql and pg_dump for new COPY api

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group