Re: Adding locks statistics

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Jeff Davis <pgsql(at)j-davis(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, "L(dot) pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding locks statistics
Date: 2026-03-22 19:37:47
Message-ID: 202603221856.iwlhitt6dxxx@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Mar-21, Álvaro Herrera wrote:

> I checked this, and found a couple of headers that can benefit from a
> removal, as shown in the attached patches.

I looked again and found some more; the first 14 patches attached here
do so. A couple of them have no fallout to speak of, which I find
really surprising; for the majority we just need a couple of extra
includes somewhere or a typedef or two. I unleashed CI on it to see
what would happen,
https://cirrus-ci.com/build/5522804717649920

The 15th one removes the inclusion of clog.h in proc.h. Not really
related to this thread, but I noticed while looking at proc.h for
removal of lock.h.

> A special case (not modified here) is proc.h. It seems to me that
> lock.h _could_ be removed from there with some effort, but the amount
> of .c files that would benefit seems to me not large enough to justify
> the number of contortions needed. Others could disagree though.

I looked at it again while doing the above and came to the same
conclusion. In order to make it work we'd need half a dozen typedefs,
and it doesn't really look very pretty.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Syntax error: function hell() needs an argument.
Please choose what hell you want to involve.

Attachment Content-Type Size
v2-0001-procarray.h-does-not-need-storage-lock.h-for-anyt.patch text/x-diff 747 bytes
v2-0002-lmgr.h-doesn-t-need-the-full-lock.h.patch text/x-diff 1.7 KB
v2-0003-namespace.h-doesn-t-need-lock.h-only-lockdefs.h.patch text/x-diff 2.9 KB
v2-0004-vacuum.h-doesn-t-need-lock.h.patch text/x-diff 1.6 KB
v2-0005-standby.h-doesn-t-need-the-full-lock.h.patch text/x-diff 1.9 KB
v2-0006-tablecmds.h-doesn-t-need-the-full-lock.h.patch text/x-diff 835 bytes
v2-0007-reloptions.h-doesn-t-need-lock.h-at-all.patch text/x-diff 2.6 KB
v2-0008-predicate.h-almost-doesn-t-need-lock.h.patch text/x-diff 1.8 KB
v2-0009-twophase.h-can-mostly-do-without-lock.h.patch text/x-diff 883 bytes
v2-0010-sinvaladt.h-doesn-t-need-lock.h-at-all.patch text/x-diff 642 bytes
v2-0011-replication-worker_internal.h-doesn-t-need-lock.h.patch text/x-diff 1.4 KB
v2-0012-cluster.h-can-do-with-just-lockdefs.h.patch text/x-diff 703 bytes
v2-0013-toasting.h-only-needs-lockdefs.h.patch text/x-diff 674 bytes
v2-0014-pg_inherits.h-doesn-t-need-the-full-lock.h.patch text/x-diff 1.6 KB
v2-0015-avoid-including-clog.h-in-proc.h.patch text/x-diff 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-03-22 19:58:27 Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Previous Message Jim Jones 2026-03-22 19:13:56 Re: [PoC] XMLCast (SQL/XML X025)