[PATCH] Add max_logical_replication_slots GUC

From: Ahmed Et-tanany <ahmed(dot)ettanany(at)aiven(dot)io>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Add max_logical_replication_slots GUC
Date: 2026-01-28 10:16:21
Message-ID: CAD7nQBCHp5jok49zcr5mbgaRKWpuiimZks2U3zV-W801pYT1JQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Hackers,

This patch introduces a new postmaster-level configuration parameter,
max_logical_replication_slots, which limits the number of logical
replication slots that can be created.

Currently, max_replication_slots governs the total number of slots,
but there's no separate limit for logical slots. This patch:

Adds max_logical_replication_slots GUC, defaulting to -1
(falls back to max_replication_slots).

Enforces at server startup that max_logical_replication_slots ≤
max_replication_slots. PostgreSQL will refuse to start if this
is violated or if there are more existing logical slots than
the configured maximum.

Checks the logical slot limit when creating new slots at runtime,
preventing creation beyond the configured maximum.

Updates documentation, sample config, and test_decoding tests
to include logical slot limits.

This provides a separation between logical and total replication
slots, and allows users to control logical slot usage independently.

Best regards,

--
Ahmed Et-tanany
Aiven: https://aiven.io/

Attachment Content-Type Size
0001-Add-max_logical_replication_slots-GUC-v1.patch text/x-patch 15.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-01-28 10:18:40 Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Previous Message Fujii Masao 2026-01-28 09:23:47 Re: Remove unused argument from ApplyLogicalMappingFile()