// postgresql · wal, redo & durability

max_slot_wal_keep_size

Most WAL a replication slot may hold back before it is invalidated; -1 is unlimited.

기본값
-1 (unlimited)
Range
-1, or 0MB to 2PB
Restart needed
아니요
Default checked on
PostgreSQL 18

기능

A replication slot keeps WAL until its consumer has received it. With an abandoned slot or a stalled subscriber, WAL grows until the disk fills. This setting caps it (PostgreSQL 13 and later).

기본값

-1 (unlimited). -1 (PostgreSQL 18).

Check the current value

SHOW max_slot_wal_keep_size;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'max_slot_wal_keep_size';

Change it

ALTER SYSTEM SET max_slot_wal_keep_size = '100GB';
SELECT pg_reload_conf();

No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When to change it

On every server that uses replication slots (logical replication, CDC tools, standbys with slots). Size it to the disk you can spare.

What can go wrong

When the limit is hit the slot is invalidated and the subscriber or standby must be re-synced.

Questions about max_slot_wal_keep_size

What is the default value of max_slot_wal_keep_size in PostgreSQL?

-1 (unlimited). -1 (PostgreSQL 18).

Does changing max_slot_wal_keep_size require a restart?

No. No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When should I change max_slot_wal_keep_size?

On every server that uses replication slots (logical replication, CDC tools, standbys with slots). Size it to the disk you can spare.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check max_slot_wal_keep_size on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.