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.96) (envelope-from ) id 1vrq4M-008n91-1B for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 04:18:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrq4K-003XDY-0l for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 04:18:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vrq4J-003XDN-2s for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 04:18:43 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vrq4H-00000000xLZ-1Pj3 for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 04:18:43 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 555C07A045E; Sun, 15 Feb 2026 23:18:39 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Sun, 15 Feb 2026 23:18:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1771215518; x=1771301918; bh=mKWIdemCUQ IMSaAMCNJxf/CHVroOyTd0/7GEZrwFdAc=; b=IZdv0CEm2wrQV5E/vQ9oMdnjf9 UH63rqtH8N8VsL/1squENVXfRa6wvIo2kvortE6HCTJ5OIZ61JIj4RMDXC4/7TA9 6nUbXOEzgbAMbuO4Kw7ElFd+VNz+cP5jUhIYMyKAyprdSl6GesFnAUz5Jh/+VIYH ZFLS254pcAmr9scXqhKOfXT8NZww0mUJSjfur464+K3HZqLKJRjGsAOJ4iK8QWG/ tQFakQohOGAAno3VtQVelLcbjpk/db3mcEBb4kEuM/a2Jl+WFAqFbmcTDmnpVYvB IB+12aXK0yR54M0ys+iTiPFsfLDUJ3na9kLq6f5wdthWD04eC0NG8c+Rv94A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1771215518; x=1771301918; bh=mKWIdemCUQIMSaAMCNJxf/CHVroOyTd0/7G EZrwFdAc=; b=ILVxW60eUfxyH31U3OC3Akor12BX87xvL+2lCndsHXosHFFQrki 0ADb8p9W6AzjV7tsjylS4sityCRzbrVdGONLaA5286WoBX65YzYN8X2bmYhZp2H8 VKRHriqDF04PaDGYRSOLFVT5SsUHoaklepUdqhRsEQyHU4wkCz9ELFkJk52uB34z NTIuHGbPT93DhcUuPICS6vo0d8UKX7Dy9i3zMyoLnvH+HLj/VQd1YjqJ5pxlu26A 7zUn67oz+qJGKv6tVCK0tje7l5ytvGJkbJFKE64fsympAhdkEre8IZblidrQYIUC rjouE4EAFrlzSXBHEcG6jboGKHIjcxIfjfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvudehkeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghnug hrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepsggvrhhtrhgrnhguughrohhu vhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhesjhdquggrvh hishdrtghomhdprhgtphhtthhopehhthgrmhhfihgushesghhmrghilhdrtghomhdprhgt phhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlh drohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 15 Feb 2026 23:18:36 -0500 (EST) Date: Mon, 16 Feb 2026 13:18:32 +0900 From: Michael Paquier To: Andres Freund Cc: Bertrand Drouvot , Jeff Davis , Greg Sabino Mullane , pgsql-hackers@lists.postgresql.org Subject: Re: Adding locks statistics Message-ID: References: <87c3170d0645cec732f0d7b2969c75db1b3c86c6.camel@j-davis.com> <1a236172c7dda72939e4293657a90536cce7dd16.camel@j-davis.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="91fVdNl6tr1yRgCU" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --91fVdNl6tr1yRgCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 13, 2026 at 04:13:39PM -0500, Andres Freund wrote: > I'm not sure that it's unproblematic to add multiple pgstat count calls to > every lock acquisition, particularly if it's a fastpath acquisition or a > virtualxid lock. Notably these are external function calls, not just > increments of a counter in an inline function. Right. I am not completely sure if this is really free, either, particularly for a fastpath lock that we want to be.. Faster. > What I would actually count is the amount of time waiting for locks, that > seems vastly more useful than the number of acquisitions. We already do a > GetCurrentTimestamp() inside the timer activations for deadlock timeout, we > probably can figure out a way to reuse that to reduce the increase in overhead > due to timing. We could also just count the wait time after the deadlock > check has run. That sounds like an interesting suggestion, yes. That's not going to be bounded by performance if we know that we are already waiting. -- Michael --91fVdNl6tr1yRgCU Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmmSmpgACgkQnvQgOdby QH1iKxAAoYkWfb6WihTkzRHkDqpvt/gQqX9Qo4TUqdlJv0QB+whKEGfxRjtER4vz Sp/OoPDdRFGAVA/2FoZZIaeldz9BakJRL0hvmmq2JqB+8Z+G+JRI/jSKYK5qsvEB U4ePH112U6pb0GUzEa/d141FXYNDLP3n94gShJ2bOg9LFK4eIPjcf1YdAtHRoaVc aVC8h58qDSG+xjJM3lQc+WcFP+ycD/Ag17Q2Ob2XT7HeB62gi+/OeCEzQPa9hwPb glOmw3xphOIb7ks8oTmp5Ti2v+HXqLO8EYXzf2GBFr3ooW8WqHDGOLdoj4vUWw/3 mxPMZQd2XoVM5KcnF4MgZCJdBTX5Bi6Cu1k4MMvLBcFjOOHs9bWMI9I/ZaXEQfwB ShIi0VLJTcRlhjVR6O49gK3ZAN+1WKaTn9WLW31jNO04Zfy78MokGn10XBycwxts t41S30JX28kWy+aAjSGRRy4qgnuutbDxY7n7OBW0Jxz972m8kOxZGeK7DboeNi9E HyOSnWBg+oZ78bbRwfjN4cgYIuFO2MP7zjBrk8uLq2P3pFB7mbUh/ZxXs0mtkiwv Abv26++h6g/YdeoUlmr8q+Yt8p2KLcyE+eOEvwbMHK1LXCsonqAx5WdrOUgsWrw0 ZCRSGsP/XKSTTdCl4j50cQNRbgae3ZkLr0HzStkfZPy7QLHJOlk= =bkaU -----END PGP SIGNATURE----- --91fVdNl6tr1yRgCU--