Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPBOH-0001rV-Ap for pgsql-general@arkaria.postgresql.org; Fri, 10 May 2019 19:41:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hPBOF-0007kl-Q0 for pgsql-general@arkaria.postgresql.org; Fri, 10 May 2019 19:41:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPBOF-0007kd-FD for pgsql-general@lists.postgresql.org; Fri, 10 May 2019 19:41:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPBOC-0002AG-JM for pgsql-general@postgresql.org; Fri, 10 May 2019 19:41:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4AJetbq014291; Fri, 10 May 2019 15:40:55 -0400 From: Tom Lane To: Andres Freund cc: Erik Jones , pgsql-general@postgresql.org Subject: Re: Hot Standby Conflict on pg_attribute In-reply-to: <20190510191437.3gjehobmxdaap7qg@alap3.anarazel.de> References: <20190510191437.3gjehobmxdaap7qg@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 10 May 2019 12:14:37 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14289.1557517255.1@sss.pgh.pa.us> Date: Fri, 10 May 2019 15:40:55 -0400 Message-ID: <14290.1557517255@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2019-05-09 13:03:50 -0700, Erik Jones wrote: >> The question then is: Why would these user queries be waiting on an >> AccessShare lock on pg_attribute? > Queries that access a table for the *first* time after DDL happened > (including truncating the relation), need an AccessShareLock on > pg_attribute (and pg_class, pg_index, ...) for a short time. Also, it seems likely that what's really triggering the issue is autovacuum on pg_attribute trying to truncate off empty pages in pg_attribute (after a bunch of dead rows were generated there by DDL activity). That requires exclusive lock on pg_attribute, which would propagate down to the standby. regards, tom lane