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 1ihjKt-0002qD-15 for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 00:06:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihjKr-0006bc-SF for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 00:06:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihjKr-0006bV-F9 for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 00:06:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ihjKp-0005TF-4p for pgsql-general@postgresql.org; Thu, 19 Dec 2019 00:06:32 +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 xBJ06R0f032764; Wed, 18 Dec 2019 19:06:27 -0500 From: Tom Lane To: Erik Jones cc: pgsql-general@postgresql.org Subject: Re: AccessExclusiveLock with pg_locks.locktype of tuple In-reply-to: References: Comments: In-reply-to Erik Jones message dated "Wed, 18 Dec 2019 15:01:30 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32762.1576713987.1@sss.pgh.pa.us> Date: Wed, 18 Dec 2019 19:06:27 -0500 Message-ID: <32763.1576713987@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Erik Jones writes: > I've seen locks with mode of AccessExclusiveLock and locktype of tuple a > few times now but have never been able to reproduce one nor had a chance to > dig into them and now have a couple questions on them: > * When is this kind of heavy lock on a row/tuple taken out? I've done some > code spelunking but have yet to find anything. It's a transient state while waiting to acquire a "normal" tuple lock, that is one recorded in the tuple header. The explanation can be found in src/backend/access/heap/README.tuplock, and the relevant code is mostly in heap_lock_tuple(). regards, tom lane