X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 61419D8504 for ; Tue, 6 Sep 2005 14:43:07 -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 35222-03 for ; Tue, 6 Sep 2005 17:43:01 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 364F0D8270 for ; Tue, 6 Sep 2005 14:43:01 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j86HgxRg019192; Tue, 6 Sep 2005 13:42:59 -0400 (EDT) To: Mark Lewis Cc: Brian Choate , pgsql-performance@postgresql.org Subject: Re: Poor performance of delete by primary key In-reply-to: <1126026278.3310.76.camel@archimedes> References: <2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com> <18162.1126020720@sss.pgh.pa.us> <1126026278.3310.76.camel@archimedes> Comments: In-reply-to Mark Lewis message dated "Tue, 06 Sep 2005 10:04:38 -0700" Date: Tue, 06 Sep 2005 13:42:59 -0400 Message-ID: <19191.1126028579@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/100 X-Sequence-Number: 14408 Mark Lewis writes: > I had a similar problem, so I downloaded 8.1 from CVS, ran it on a > relatively gnarly dev workstation, imported a dump of my 8.0 database, > and ran my troublesome queries with the new EXPLAIN ANALYZE. > This process took about an hour and worked great, provided that you've > actually named your foreign key constraints. Otherwise, you'll find out > that there's a trigger for a constraint called $3 that's taking up all > of your time, but you won't know what table that constraint is on. But at least you've got something you can work with. Once you know the name of the problem trigger you can look in pg_trigger to see which other table it's connected to. Try something like select tgname, tgconstrrelid::regclass, tgargs from pg_trigger where tgrelid = 'mytable'::regclass; regards, tom lane