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

Re: How do I see what triggers are called on cascade?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: andrew(at)pillette(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How do I see what triggers are called on cascade?
Date: 2004-08-24 02:50:41
Message-ID: 27145.1093315841@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
andrew(at)pillette(dot)com writes:
> I'm still having trouble with slow cascading DELETEs. What commands can I issue to see the sequence of events that occurs after I execute 
> DELETE FROM x WHERE p;
> so that I can see if indexes being used correctly, or I have a constraint I don't want, etc.

I'd suggest starting a fresh backend, turning on log_statement, and then
issuing the DELETE.  log_statement will log the queries generated by the
foreign-key triggers ... but only the first time through, because those
triggers cache the query plans.

The queries you will see will be parameterized (they'll use $1,$2,etc).
You can use PREPARE and EXPLAIN ANALYZE EXECUTE to investigate what sort
of plans result.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: my hoDate: 2004-08-24 05:08:42
Subject: Re: postgresql performance with multimedia
Previous:From: andrewDate: 2004-08-24 00:02:18
Subject: How do I see what triggers are called on cascade?

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