Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 83F8D9FBADD for ; Tue, 3 Jul 2007 03:29:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 57064-03-2 for ; Tue, 3 Jul 2007 03:29:08 -0300 (ADT) X-Greylist: delayed 00:23:25.255566 by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4E3979FBD30 for ; Tue, 3 Jul 2007 03:29:05 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by svr4.postgresql.org (Postfix) with ESMTP id A67225AF8A3 for ; Tue, 3 Jul 2007 06:05:40 +0000 (GMT) Received: from fwd26.aul.t-online.de by mailout08.aul.t-online.de with smtp id 1I5bW6-0005xa-00; Tue, 03 Jul 2007 08:05:38 +0200 Received: from [192.168.1.2] (bNUidvZFQeXOgO+kTle3ckA7EbcTbh0IjhXU3hNCfhhuDohkJM7g8s@[87.177.69.222]) by fwd26.aul.t-online.de with esmtp id 1I5bVz-1cxyNM0; Tue, 3 Jul 2007 08:05:31 +0200 Message-ID: <4689E727.5020408@p-dw.com> Date: Tue, 03 Jul 2007 08:05:27 +0200 From: Patric de Waha User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Delete Cascade FK speed issue Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: bNUidvZFQeXOgO+kTle3ckA7EbcTbh0IjhXU3hNCfhhuDohkJM7g8s@t-dialin.net X-TOI-MSGID: b99f6678-933e-4a93-a902-d934aeb52a28 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=BAYES_50=0.001, UNPARSEABLE_RELAY=0.001 X-Spam-Level: X-Archive-Number: 200707/7 X-Sequence-Number: 25691 Hi, I've dbase with about 80 relations. On deleting a user, this cascades through all the tables. This is very slow, for 20 users it takes 4 hours, with exclusive access to the dbase. No other users connected to the dbase. Ok I know there will be somewhere a relation with a FK without index, which is being scanned sequentially. But how can I find out what postgres is doing while it is handling the transaction? Is there a way I can find out what postgres does, and where it hangs around, so I know where the FK might not be indexed. (The dbase is to big to analyze it by hand). The way I do it now is to check the pg_locks relation, but this is not very representative. Is there profiling method for triggers/constraints, or a method which gives me a hint why it is taking so long? thanks in advance