idle_replication_slot_timeout
Fact — official short description: “Sets the duration a replication slot can remain idle before it is invalidated.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG18 |
| Present in | PG18–19 Beta 3 |
| Removed in | No |
| Introduction commit | ac0e33136abc — Invalidate inactive replication slots. |
| Commit date | 2025-02-19 |
| Discussion | thread 1 · thread 2 |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG18–19 Beta 3 | 0 |
s |
0 s |
How it works
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
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. |
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 |
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
- 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
max_replication_slots · max_slot_wal_keep_size · primary_slot_name · wal_keep_size · checkpoint_timeout · max_wal_senders
References
- PostgreSQL 19 Beta 3 — idle_replication_slot_timeout
- PostgreSQL 19 release notes
- Machine-readable GUC export