Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 308209FBA55 for ; Thu, 5 Apr 2007 02:24:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 66042-04-5 for ; Thu, 5 Apr 2007 02:23:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 384D59FB907 for ; Thu, 5 Apr 2007 02:23:53 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l355NoiP019115; Thu, 5 Apr 2007 01:23:50 -0400 (EDT) To: Richard Broersma Jr cc: Bryce Nesbitt , pgsql-sql@postgresql.org Subject: Re: Very slow DELETE on 4000 rows of 55000 row table In-reply-to: <880852.63314.qm@web31801.mail.mud.yahoo.com> References: <880852.63314.qm@web31801.mail.mud.yahoo.com> Comments: In-reply-to Richard Broersma Jr message dated "Wed, 04 Apr 2007 21:46:10 -0700" Date: Thu, 05 Apr 2007 01:23:50 -0400 Message-ID: <19114.1175750630@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/64 X-Sequence-Number: 28064 Richard Broersma Jr writes: >> But I DELETE all conflicting those rows prior to the slow DELETE, just >> so the FK check is never hit. Should I be looking at subverting the FK >> check mechanism somehow? The necessary index would be huge, and >> relevant only on this particular operation which happens every few >> months, if that. > true, but without an index, it still has to scan the table just to be sure. If this is only a once-in-awhile thing, maybe you could build the index, do the deletes, drop the index ... regards, tom lane