Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 987D063265B for ; Thu, 2 Sep 2010 00:20:44 -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 97594-09 for ; Thu, 2 Sep 2010 03:20:37 +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 40DD2632460 for ; Thu, 2 Sep 2010 00:20:37 -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 o823KZQi012513; Wed, 1 Sep 2010 23:20:35 -0400 (EDT) To: Kevin Kempter cc: pgsql-admin@postgresql.org Subject: Re: dropping constraints In-reply-to: <201009012058.05142.cs_dba@consistentstate.com> References: <201009012058.05142.cs_dba@consistentstate.com> Comments: In-reply-to Kevin Kempter message dated "Wed, 01 Sep 2010 20:58:05 -0600" Date: Wed, 01 Sep 2010 23:20:35 -0400 Message-ID: <12512.1283397635@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: 201009/7 X-Sequence-Number: 35551 Kevin Kempter writes: > we have a few not null constraints we want to drop on very large tables. > Unfortunately the drop's are taking hours. Is there a way to drop a not null > constraint via the system catalogs? Dropping a NOT NULL constraint is a trivial operation. The problem is probably that you are blocked waiting to get a lock on the table. Look for idle-in-transaction sessions that are holding locks on the target table. regards, tom lane