Refactor GetLockStatusData() to skip backends/groups without fast-path locks.
Fujii Masao <fujii@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/lmgr/lock.c | modified | +39 −28 |
Discussion
- Refactor GetLockStatusData() by skipping unused backends and groups 5 messages · 2024-10-21 → 2024-10-24