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 15C3352A1A for ; Thu, 7 Jul 2005 11:02:34 -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 09802-09 for ; Thu, 7 Jul 2005 14:02:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C152F52A0E for ; Thu, 7 Jul 2005 11:02:21 -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 j67E2PvJ007518; Thu, 7 Jul 2005 10:02:25 -0400 (EDT) To: Bendik Rognlien Johansen Cc: pgsql-performance@postgresql.org Subject: Re: How to speed up delete In-reply-to: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> References: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> Comments: In-reply-to Bendik Rognlien Johansen message dated "Thu, 07 Jul 2005 13:16:30 +0200" Date: Thu, 07 Jul 2005 10:02:25 -0400 Message-ID: <7517.1120744945@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/70 X-Sequence-Number: 13311 Bendik Rognlien Johansen writes: > I am running few of these deletes (could become many more) inside a > transaction and each one takes allmost a second to complete. > Is it because of the foreign key constraint, or is it something else? You need an index on "original" to support that FK efficiently. Check for references from other tables to this one, too. regards, tom lane