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 4A35852A37 for ; Fri, 25 Mar 2005 01:48:51 +0000 (GMT) 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 40886-04 for ; Fri, 25 Mar 2005 01:48:41 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5D66552A3D for ; Fri, 25 Mar 2005 01:48:40 +0000 (GMT) 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 j2P1mcmC003751; Thu, 24 Mar 2005 20:48:38 -0500 (EST) To: Karim Nassar Cc: pgsql-performance@postgreSQL.org Subject: Re: Delete query takes exorbitant amount of time In-reply-to: <1111715131.9085.174.camel@k2.cet.nau.edu> References: <1111709457.9085.127.camel@k2.cet.nau.edu> <2630.1111711927@sss.pgh.pa.us> <1111715131.9085.174.camel@k2.cet.nau.edu> Comments: In-reply-to Karim Nassar message dated "Thu, 24 Mar 2005 18:45:31 -0700" Date: Thu, 24 Mar 2005 20:48:38 -0500 Message-ID: <3750.1111715318@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/530 X-Sequence-Number: 11235 Karim Nassar writes: >> Look at what your triggers are doing. My private bet is that you have >> unindexed foreign keys referencing this table, and so each deletion >> forces a seqscan of some other, evidently very large, table(s). > Almost. I have a large table (6.3 million rows) with a foreign key > reference to this one (which has 749 rows), however it is indexed. In that case there's a datatype mismatch between the referencing and referenced columns, which prevents the index from being used for the FK check. regards, tom lane