pg_walrus
pg_walrus · Automatic max_wal_size tuning based on checkpoint activity
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101102 | pg_walrus | pg_walrus | 0.1.0 | ADMIN | PostgreSQL | Rust |
PostgreSQL · 15, 16, 17, 18
Usage
Sources:
- Upstream README at the reviewed commit
- Background-worker implementation
- SQL-callable functions
- Extension control file
pg_walrus monitors requested checkpoints and automatically increases or decreases max_wal_size. It requires shared_preload_libraries and a restart; create the extension in the database selected by walrus.database to store adjustment history.
Start with walrus.dry_run = true. The worker normally executes ALTER SYSTEM, writes postgresql.auto.conf, and sends SIGHUP when its threshold, cap, shrink, cooldown, and hourly-rate rules select a change. walrus.history records decisions; walrus.analyze(apply := true) can apply one immediately and requires superuser.
Changing WAL sizing affects checkpoint cadence, disk usage, crash recovery, replication retention, and backup operations. Validate the algorithm under peak WAL rates, set a safe walrus.max and walrus.min_size, monitor free space, and coordinate with existing configuration management so automated rewrites do not fight declarative settings.