On Mon, 18 Aug 2025 at 18:23, James Pang <jamespang...@gmail.com> wrote: > not tested and any regression found either, with 10k connections, and > "max_locks_per_transaction=128", it need about more than 1GB extra > memory,right? per my understanding, max_locks_per_transaction is the max > locked objects in a transaction (that's not an average locked objects at the > same time among all connections), but for past-path-lock slots, the memory > will be allocated based on this parameter after client connection > established, right? so, even no so many fast lock slots needed, for 10k > connections, extra memory got allocated there. We may test that in our > environment, and update then if anything found.
Can you share how you came to 1GB extra? By my calculations, I believe it's an extra 5625 kB total for the entire instance. select pg_size_pretty((max_locks_per_xact / 16 * 8 + max_locks_per_xact / 16 * 4 * 16) * connections::numeric) from (values(128,10000)) v(max_locks_per_xact, connections); David