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 1uloWe-005svl-P9 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Aug 2025 12:54:48 +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 1uloWc-007SLi-9h for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Aug 2025 12:54:46 +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 1uloWb-007SLY-U8 for pgsql-hackers@lists.postgresql.org; Tue, 12 Aug 2025 12:54:46 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uloWZ-000Bmv-0V for pgsql-hackers@lists.postgresql.org; Tue, 12 Aug 2025 12:54:44 +0000 Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-3e55955915aso9137485ab.1 for ; Tue, 12 Aug 2025 05:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755003283; x=1755608083; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/zMNmSdwLKKS2ya9DLbnyDYcocNWo8dv8Wlymh8XYNM=; b=AU9z8GeogDcZbH0EGp+9q/V0t+cHW839yq8hyeZB7knAprxEAojWiGfMXIvzxoE+9s MDtTSIKE9ne5KN2ESbkrCJ8CcInKxaXQRJF+VQQwU86ztSo4hXpvNaJ7v823sNPFx/QS InCkB+bRlM0lC8PIoTFvyMAVWLYxY5LclVb/X87b/q1lOAYAK1lXUSWy9mmMvFVID3Uv dozoq9xcBeRrhn/5tvRtfnndpjzLtKa7A0Vnmrt8hXs1U9JFvWw93pLzUxwgxqyunEl8 nDIsK8GdSQFV1KQr41GGqeH693faVUNTQne9WpiA0JUv3wRJl3pxzB7WdT4h9/Bh1j7l aZzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755003283; x=1755608083; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/zMNmSdwLKKS2ya9DLbnyDYcocNWo8dv8Wlymh8XYNM=; b=iqywUSl16WC6JnMSGfo4w+qWbvzS68OIxVOOnEWgqYWD3iSkBt4Sp3nlk/G2A5a5ub YC9EZR90ri/1vEs7Fe08494ueRS6DBkrS/POGciYy40V4ic9/RpIMSZseP2pQ9mVdjgz 9zIeIzwWAL0/Qg8WjP4l1mlJ0xxh7eW3TXUdNwhJmatsHfb09nugpD8XHy4Qq5ylmYje Zg8CM0ZF2FEH58PjsohWgZm7/QYcLN+DnxF8cN1dEgiaIqMtKqNrk32Nwevr495wBk3Z e2Y1/2/cxeXDsKqFuY45CtZxau2fpxOD8FSZwDmh8vrAkOMadrX4gQ50qXS01dHVLV7g huIQ== X-Gm-Message-State: AOJu0YzaSjHfsHyIQoh/9OyK1Mfx0fBNSwMKWY4298U5rLk2gE4nzFtw CccrFOxKN78d1oPzv6WRSJBxnTc2fZwMYHek7ZI33mR5iNUdRIv/X+/seL47ouLPSyj49ALMrMp jdhE+L5zswZFVgfLkCDib/AGS/JTsWMpm4edZRH0= X-Gm-Gg: ASbGncvKw82sX/GNZfR0SjzWhtI/Dlt1vvDb8Zqm8/d/C5e66lYxg8SbnLKa0Xk4pRO S1j5t4fRnDIQ1/xZVl+rxniT+tUgnent5tVmAumehOv+5nTKOwY+jiild3chE/cQwZwj41vC2/X qk90nhCZxrA2HuHt9lPfvncEEIwCVA/B7CPb//NBJGUBi+Ukm36RF72b6wjLwzFYmZ1Vdpqgomc 6kag8zrcMMr8CDBgeT0Pv3AADCdyjmKUCxiVXM7XQ== X-Google-Smtp-Source: AGHT+IEaboxsbIlCnvu7lEedZDKG2cQDQkoEBqjEbDmC6iK+p9mNaMia/crMHf5uCBCBqDwApaykf89dibuAso5kClM= X-Received: by 2002:a05:6e02:2301:b0:3e5:4b2e:3aec with SMTP id e9e14a558f8ab-3e55ae55096mr48541785ab.0.1755003282763; Tue, 12 Aug 2025 05:54:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sabino Mullane Date: Tue, 12 Aug 2025 08:54:07 -0400 X-Gm-Features: Ac12FXytMcD8Qv1H8dWL1O459x3I17WtoGPuiXsJF5NfuBn6O-30b0u9fvYz4qc Message-ID: Subject: Re: Adding locks statistics To: Bertrand Drouvot Cc: pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000003fb53a063c2a8b97" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003fb53a063c2a8b97 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 12, 2025 at 5:32=E2=80=AFAM Bertrand Drouvot < bertranddrouvot.pg@gmail.com> wrote: > I considered pg_stat_locks, but chose the singular form to be consistent > with > pg_stat_database, pg_stat_subscription, and friends. > Counter-examples: pg_stat_statements, pg_stat_subscription_stats. Our names are not consistent. :) It just feels a better fit to have a plural name for a table tracking aggregates of multiple types of objects. (Ignore my git complaint, was obviously half-asleep when I wrote that). > Docs: seem good. Needs a section on how to reset via > > SELECT pg_stat_reset_shared('lock'); > I meant something closer to the actual description of the view. Having it buried in the pg_stat_reset_shared section is not intuitive for people looking up the view in the docs. > Because it looks like that they are ordered by alphabetical order. > That makes sense. > - I'm not sure that's worth for this particular case and code paths. > Will let others opine on that. Thanks! Did you observe some noticeable performance penalties? > No, but I did not give it any particularly heavy testing. More of a idle thought when pulling up a brand new system and seeing the thousands of locks for the tiniest bit of database action. Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support --0000000000003fb53a063c2a8b97 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Aug 12, 2025 at 5:32=E2=80=AFAM B= ertrand Drouvot <bertran= ddrouvot.pg@gmail.com> wrote:
I conside= red pg_stat_locks, but chose the singular form to be consistent with
pg_stat_database, pg_stat_subscription, and friends.
<= br>
Counter-examples: pg_stat_statements, pg_stat_subscription_st= ats. Our names are not consistent. :) It just feels a better fit to have a = plural name for a table tracking aggregates=C2=A0of multiple types of objec= ts.

(Ignore my git complaint, was obviously half-a= sleep when I wrote that).

> Docs: seem good. Needs a section on how to reset via
> SELECT pg_stat_reset_shared('lock');

=
I meant something closer to the actual description of the view.= =C2=A0 Having it buried in the pg_stat_reset_shared section is not intuitiv= e for people looking up the view in the docs.
=C2=A0
Because it looks like that they are ordered by alphabetical order.

That makes sense.
=C2=A0
- I'm not sure that's wo= rth for this particular case and code paths.

Will let others opine on that.

Thanks! Did you observe some noticeable pe= rformance penalties?

No, but I did not = give it any particularly heavy testing. More of a idle thought when pulling= up a brand new system and seeing the thousands of locks for the tiniest bi= t of database action.
=C2=A0
Cheers,
Greg

--
Enterpri= se Postgres Software Products & Tech Support

=
--0000000000003fb53a063c2a8b97--