Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4DA666351C5 for ; Tue, 22 Sep 2009 21:17:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 21634-01-5 for ; Wed, 23 Sep 2009 00:17:28 +0000 (UTC) X-Greylist: delayed 00:06:39.21963 by SQLgrey-1.7.6 Received: from mail4.sea5.speakeasy.net (mail4.sea5.speakeasy.net [69.17.117.6]) by mail.postgresql.org (Postfix) with ESMTP id 53A36634399 for ; Tue, 22 Sep 2009 21:17:01 -0300 (ADT) Received: (qmail 15349 invoked from network); 23 Sep 2009 00:10:19 -0000 Received: from dsl081-048-173.sfo1.dsl.speakeasy.net (HELO xena.bepress.com) ([64.81.48.173]) (envelope-sender ) by mail4.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 23 Sep 2009 00:10:19 -0000 Received: from [192.168.1.146] (unknown [192.168.1.146]) by xena.bepress.com (Postfix) with ESMTP id CD0137358A for ; Tue, 22 Sep 2009 17:10:18 -0700 (PDT) Message-ID: <4AB9676A.6070301@obviously.com> Date: Tue, 22 Sep 2009 17:10:18 -0700 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090303 SeaMonkey/1.1.15 (Ubuntu-1.1.15+nobinonly-0ubuntu0.8.04.2) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: AccessExclusiveLock on CREATE TABLE REFERENCES deadlocks (formatted better) References: <4AB90198.2010109@obviously.com> <13526.1253640939@sss.pgh.pa.us> In-Reply-To: <13526.1253640939@sss.pgh.pa.us> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.141 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.457 X-Spam-Level: X-Archive-Number: 200909/108 X-Sequence-Number: 33173 Tom Lane wrote:
Bryce Nesbitt <bryce2@obviously.com> writes:
  
1) Why the AccessExclusiveLock on create table?
    

It has to install a trigger on the referenced table.  There has been
some discussion that maybe CREATE TRIGGER could take just ExclusiveLock
and not AccessExclusiveLock, but it hasn't been done yet; and I'm not
sure how much that would help you anyway.  It would only help if the
referenced table (contexts) is essentially read-only to the rest of
your workload, else it'll block anyhow.
Thanks for the great info.

In our case all the long running access is read-only.  We have a poorly designed table that several postgres consultants have burned out on trying to fix.

Most notably there are also zillions of short read-only references that presently block while the create table attempts to gain the AccessExclusiveLock.

                          -Bryce