Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3Vy7-00018b-8P for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Feb 2013 18:13:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3Vy6-0000xB-8K for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Feb 2013 18:13:06 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3Vy5-0000x6-Og for pgsql-bugs@postgresql.org; Thu, 07 Feb 2013 18:13:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3Vy3-0006FZ-Fg for pgsql-bugs@postgresql.org; Thu, 07 Feb 2013 18:13:05 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r17ICxFc016241; Thu, 7 Feb 2013 13:12:59 -0500 (EST) From: Tom Lane To: Josh Berkus cc: pgsql-bugs@postgresql.org Subject: Re: Why does FK creation still take an access exclusive lock on the referenced table? In-reply-to: <5113ED30.1070903@agliodbs.com> References: <5113ED30.1070903@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 07 Feb 2013 10:06:40 -0800" Date: Thu, 07 Feb 2013 13:12:58 -0500 Message-ID: <16240.1360260778@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Josh Berkus writes: > I understand why establishing an FK needs an ExclusiveLock on the > referenced table, but it doesn't need an AccessExclusiveLock. Yes, it does, because it's adding triggers. We can't improve this in the near term, and complaining about it doesn't change that. At the very least we need MVCC catalog scans before we can think about reducing lock levels for DDL. I forget whether there are any other issues... regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs