Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1taj2g-004UyT-Ca for pgsql-admin@arkaria.postgresql.org; Wed, 22 Jan 2025 22:17:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1taj2f-006EZA-GH for pgsql-admin@arkaria.postgresql.org; Wed, 22 Jan 2025 22:17:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1taj2f-006EZ0-5r for pgsql-admin@lists.postgresql.org; Wed, 22 Jan 2025 22:17:45 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1taj2c-000z9q-3B for pgsql-admin@lists.postgresql.org; Wed, 22 Jan 2025 22:17:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 50MMHgx94167143; Wed, 22 Jan 2025 17:17:42 -0500 From: Tom Lane To: msalais@msym.fr cc: "'Rajesh Kumar'" , pgsql-admin@lists.postgresql.org Subject: Re: Commit with wait event on advisory lock! In-reply-to: <011401db6d19$1d98ba40$58ca2ec0$@msym.fr> References: <00c201db6c13$7a1fbb80$6e5f3280$@msym.fr> <00e801db6c63$acd0f8a0$0672e9e0$@msym.fr> <3505513.1737506928@sss.pgh.pa.us> <010f01db6cf1$c07f7be0$417e73a0$@msym.fr> <3938129.1737566668@sss.pgh.pa.us> <011401db6d19$1d98ba40$58ca2ec0$@msym.fr> Comments: In-reply-to message dated "Wed, 22 Jan 2025 23:00:56 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4167141.1737584262.1@sss.pgh.pa.us> Date: Wed, 22 Jan 2025 17:17:42 -0500 Message-ID: <4167142.1737584262@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk writes: > But my concern here is really to understand in which situations, a COMMIT > statement can wait on a lock especially that I have no triggers, and no > deferrable constraints... The core code does nothing with advisory locks. If COMMIT is blocking on one of those, it must be a consequence of user-defined code that is running at pre-commit time. You've given us nothing to go on about what that could be. > By the way I also have commits which are waiting on ClientRead... That, on the other hand, is surely impossible. I think maybe you are misreading the stats display. Typically I'd expect that such a case indicates that the session is idle (awaiting a new command) and the COMMIT is the last thing it did before that. regards, tom lane