# max_replication_slots

> max_replication_slots — Sets the maximum number of simultaneously defined replication slots. Observed in PG9.4–19 Beta 3; its last measured boot default is 10 in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Sets the maximum number of simultaneously defined replication slots.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | — | Raw unit |
| Range | `0` – `262143` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Replication / Sending Servers | Upstream classification |
| Latest boot value | `10` | 10 |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.4 |
| Present in | PG9.4–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`858ec11858a9`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=858ec11858a914d4c380971985709b6d6b7dd6fc) — Introduce replication slots. |
| Commit date | 2014-01-31 |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.4–9.6 | `0` | — | 0 |
| PG10–19 Beta 3 | `10` | — | 10 |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

PostgreSQL allocates replication-slot control capacity at server start. Physical slots can reserve WAL for standbys, while logical slots can reserve both WAL and catalog visibility information for decoding consumers.

The setting limits slot objects, not active WAL-sender connections; max_wal_senders is a separate limit. Slot use also requires wal_level = replica or higher. Reducing the setting below the number of existing slots prevents the server from starting.

An unused slot is not harmless merely because it has no active process. A persistent inactive slot can retain WAL, and a logical slot can hold catalog_xmin, so slot inventory and consumer lifecycle are as important as the numerical ceiling.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Budget slots from named physical standbys, logical subscriptions, CDC consumers, backup or migration tools, failover slots, and provisioning headroom. Keep a small reserve, but pair a larger ceiling with ownership, expiry, and lag monitoring. |
| OLAP | Allow for logical consumers and migration jobs, but remember that high-WAL batch periods magnify the cost of any abandoned slot. Monitor restart_lsn and confirmed_flush_lsn before and during bulk work. |
| Small nodes | Keep the ceiling close to the real consumer count plus limited reserve. A large value does not itself retain WAL, but it makes unmanaged slot sprawl easier and can turn a small disk incident into an outage. |
{.full-width}

## Pigsty {#pigsty}

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

| Template | Effective value | Versus upstream boot | Source expression |
| --- | --- | --- | --- |
| OLTP | `50` | different | `50` |
| OLAP | `50` | different | `50` |
| CRIT | `50` | different | `50` |
| TINY | `50` | different | `50` |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG9.4–19 Beta 3 = 50 (dcs); OLAP: PG9.4–19 Beta 3 = 50 (dcs); CRIT: PG9.4–19 Beta 3 = 50 (dcs); TINY: PG9.4–19 Beta 3 = 50 (dcs). Advice, pending human review — confirm the operational intent against the current Pigsty templates and supported PostgreSQL versions before publication.

## Common pitfalls {#common-pitfalls}

- Confusing the slot limit with max_wal_senders, which limits concurrent sender processes.
- Lowering the value below the current slot count and making PostgreSQL fail to start.
- Assuming inactive slots cannot retain WAL or catalog row versions.
- Raising the ceiling without monitoring restart_lsn, catalog_xmin, and consumer health.
- Creating permanent slots during experiments and never dropping them.

## Related parameters {#related-parameters}

[`max_wal_senders`](/parameters/max-wal-senders/) · [`max_slot_wal_keep_size`](/parameters/max-slot-wal-keep-size/) · [`wal_level`](/parameters/wal-level/) · [`idle_replication_slot_timeout`](/parameters/idle-replication-slot-timeout/) · [`max_logical_replication_workers`](/parameters/max-logical-replication-workers/) · [`primary_slot_name`](/parameters/primary-slot-name/)

## References {#references}

- [PostgreSQL 19 Beta 3 — max_replication_slots](https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS)
- [PostgreSQL 18: Replication Slots](https://www.postgresql.org/docs/18/warm-standby.html#STREAMING-REPLICATION-SLOTS)
- [PostgreSQL 18: pg_replication_slots](https://www.postgresql.org/docs/18/view-pg-replication-slots.html)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
