X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C35155E3632 for ; Mon, 23 Aug 2004 23:50:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31737-09 for ; Tue, 24 Aug 2004 02:50:37 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 82D395E40BA for ; Mon, 23 Aug 2004 23:50:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7O2ofaS027146; Mon, 23 Aug 2004 22:50:41 -0400 (EDT) To: andrew@pillette.com Cc: pgsql-performance@postgresql.org Subject: Re: How do I see what triggers are called on cascade? In-reply-to: <200408240002.i7O02Iq30466@pillette.com> References: <200408240002.i7O02Iq30466@pillette.com> Comments: In-reply-to andrew@pillette.com message dated "Mon, 23 Aug 2004 17:02:18 -0700" Date: Mon, 23 Aug 2004 22:50:41 -0400 Message-ID: <27145.1093315841@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/318 X-Sequence-Number: 7954 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