# idle_replication_slot_timeout

> idle_replication_slot_timeout — Sets the duration a replication slot can remain idle before it is invalidated. Observed in PG18–19 Beta 3; its last measured boot default is 0 s in PG19 Beta 3, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Sets the duration a replication slot can remain idle before it is invalidated.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | `s` | Raw unit |
| Range | `0` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Replication / Sending Servers | Upstream classification |
| Latest boot value | `0` | 0 s |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG18 |
| Present in | PG18–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`ac0e33136abc`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=ac0e33136abc4668c9b08e1ba7db69afe1e0e2c3) — Invalidate inactive replication slots. |
| Commit date | 2025-02-19 |
| Discussion | [thread 1](https://postgr.es/m/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com) · [thread 2](https://postgr.es/m/OS0PR01MB5716C131A7D80DAE8CB9E88794FC2@OS0PR01MB5716.jpnprd01.prod.outlook.com) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG18–19 Beta 3 | `0` | `s` | 0 s |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

Sets the duration a replication slot can remain idle before it is invalidated. A configuration reload applies a new value; existing work already in flight is not retroactively changed.

PostgreSQL 18 measures inactivity from pg_replication_slots.inactive_since and invalidates eligible slots at a checkpoint after the timeout. Zero disables the policy; slots that reserve no WAL and synchronized standby slots are outside this mechanism.

Monitor and change idle_replication_slot_timeout together with max_replication_slots, max_slot_wal_keep_size, primary_slot_name. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value.

## Tuning advice {#tuning-advice}

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

| Workload | Guidance |
| --- | --- |
| OLTP | Size idle_replication_slot_timeout from topology, failover roles, slot/subscription count, and reconnect headroom. Test worst-case primary latency, standby replay, and disk retention before production. |
| OLAP | Read standbys and logical subscribers often see long queries or large transactions. Put explicit bounds on replay/apply and monitor lag, worker saturation, slot restart_lsn, and conflict cancellations. |
| Small nodes | Configure only replication capacity that is actually used. Even a small topology needs bounded timeouts and slot lifecycle; unlimited retention is not reliability. |
{.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 | `7d` | different | `7d` |
| OLAP | `7d` | different | `7d` |
| CRIT | `3d` | different | `3d` |
| TINY | `7d` | different | `7d` |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG18–19 Beta 3 = 7d (dcs); OLAP: PG18–19 Beta 3 = 7d (dcs); CRIT: PG18–19 Beta 3 = 3d (dcs); TINY: PG18–19 Beta 3 = 7d (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to invalidate forgotten PG18 slots, with a stricter window in the CRIT profile; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.

## Common pitfalls {#common-pitfalls}

- Expecting invalidation exactly when the duration expires rather than at a later checkpoint.
- Assuming synchronized standby slots are eligible.
- Allowing an automatic invalidation without a subscriber rebootstrap runbook.
- Changing it on the wrong primary, standby, sender, or subscriber role.
- Watching only configured bytes/time instead of actual lag, slot position, and worker state.

## Related parameters {#related-parameters}

[`max_replication_slots`](/parameters/max-replication-slots/) · [`max_slot_wal_keep_size`](/parameters/max-slot-wal-keep-size/) · [`primary_slot_name`](/parameters/primary-slot-name/) · [`wal_keep_size`](/parameters/wal-keep-size/) · [`checkpoint_timeout`](/parameters/checkpoint-timeout/) · [`max_wal_senders`](/parameters/max-wal-senders/)

## References {#references}

- [PostgreSQL 19 Beta 3 — idle_replication_slot_timeout](https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-IDLE-REPLICATION-SLOT-TIMEOUT)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
