Re: Guidance on Calculating max_locks_per_transaction for a Highly Partitioned Environment

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Guidance on Calculating max_locks_per_transaction for a Highly Partitioned Environment
Date: 2026-06-30 16:47:11
Message-ID: CANzqJaAO05XN2PLrf3t1TzvR9Gp4f4nDUCjdOxEWkSkJLy9jaw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 30, 2026 at 9:26 AM Vivek Gadge <vvkgadge56(at)gmail(dot)com> wrote:

> Hello Team,
>
> I am looking for guidance on determining an appropriate value for the
> max_locks_per_transaction parameter in our PostgreSQL 17.6 production
> environment.
>
> Environment has the following characteristics:
>
> PostgreSQL Version: 17.6
> max_connections = 1500
>

That's HIGH. If you have that many concurrent connections, then you really
need a connection pooler.

> Is there a recommended methodology or formula for estimating
> max_locks_per_transaction.
>
> Our objective is to determine an appropriate value based on workload
> characteristics rather than increasing the parameter through trial and
> error.
>

The memory structures handling locks per transaction are really light. I
set the value to 15000 (where average connection count is around 30) and
then worry about something else.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message masheed ullah 2026-07-01 07:15:14 Re: Postgresql Wal archive and Barman setup
Previous Message sa sa 2026-06-30 16:17:21 Postgresql Wal archive and Barman setup