Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6B824B5FE63 for ; Mon, 6 Jun 2011 17:37:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 24148-05 for ; Mon, 6 Jun 2011 20:37:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 3657CB5FE57 for ; Mon, 6 Jun 2011 17:37:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p56KbpKR012693; Mon, 6 Jun 2011 16:37:51 -0400 (EDT) To: Mike Broers cc: pgsql-performance@postgresql.org Subject: Re: poor performance when recreating constraints on large tables In-reply-to: References: Comments: In-reply-to Mike Broers message dated "Mon, 06 Jun 2011 15:35:04 -0500" Date: Mon, 06 Jun 2011 16:37:51 -0400 Message-ID: <12692.1307392671@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/35 X-Sequence-Number: 43968 Mike Broers writes: > I am in the process of implementing cascade on delete constraints > retroactively on rather large tables so I can cleanly remove deprecated > data. The problem is recreating some foreign key constraints on tables of > 55 million rows+ was taking much longer than the maintenance window I had, > and now I am looking for tricks to speed up the process, hopefully there is > something obvious i am overlooking. maintenance_work_mem? regards, tom lane