pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: andrew@pillette.com
Cc: pgsql-performance@postgresql.org
Subject: Re: How do I see what triggers are called on cascade?
Date: Mon, 23 Aug 2004 22:50:41 -0400
Message-ID: <27145.1093315841@sss.pgh.pa.us> (raw)
In-Reply-To: <200408240002.i7O02Iq30466@pillette.com>
References: <200408240002.i7O02Iq30466@pillette.com>

andrew@pillette.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



view thread (2+ messages)

Message-ID: <27145.1093315841@sss.pgh.pa.us>
Permalink:  ../27145.1093315841@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27145.1093315841@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@pillette.com
  Subject: Re: How do I see what triggers are called on cascade?
  In-Reply-To: <27145.1093315841@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox