pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor GetLockStatusData() to skip backends/groups without fas
Date: Thu, 24 Oct 2024 15:21:39 +0000
Message-ID: <E1t3zed-002FIv-VW@gemulon.postgresql.org> (raw)

Refactor GetLockStatusData() to skip backends/groups without fast-path locks.

Previously, GetLockStatusData() checked all slots for every backend
to gather fast-path lock data, which could be inefficient. This commit
refactors it by skipping backends with PID=0 (since they don't hold
fast-path locks) and skipping groups with no registered fast-path locks,
improving efficiency.

This refactoring is particularly beneficial, for example when
max_connections and max_locks_per_transaction are set high,
as it reduces unnecessary checks across numerous slots.

Author: Fujii Masao
Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/a0a00c44-31e9-4c67-9846-fb9636213ac9@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/86c30cef4a4cae951b2c30f1790fd5a7b81a2946

Modified Files
--------------
src/backend/storage/lmgr/lock.c | 67 ++++++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 28 deletions(-)



Message-ID: <E1t3zed-002FIv-VW@gemulon.postgresql.org>
Permalink:  ../E1t3zed-002FIv-VW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t3zed-002FIv-VW@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor GetLockStatusData() to skip backends/groups without fas
  In-Reply-To: <E1t3zed-002FIv-VW@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox