Re: max_locks_per_transaction v18 - Mailing list pgsql-hackers

From David Rowley
Subject Re: max_locks_per_transaction v18
Date
Msg-id CAApHDvqnZhZ3C6qZZMDxN6W9y7x_xDwbLhZoQU3QL1WBgBk4Ew@mail.gmail.com
Whole thread Raw
In response to Re: max_locks_per_transaction v18  (James Pang <jamespang886@gmail.com>)
List pgsql-hackers
On Mon, 18 Aug 2025 at 18:23, James Pang <jamespang886@gmail.com> wrote:
>     not tested and any regression found either, with 10k connections, and  "max_locks_per_transaction=128",  it need
aboutmore 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
manyfast 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



pgsql-hackers by date:

Previous
From: Nisha Moond
Date:
Subject: Re: Parallel Apply
Next
From: "zengman"
Date:
Subject: Re: When deleting the plpgsql function, release the CachedPlan of the function