wal_level
How much information is written to the WAL.
- 預設
replica- Range
- minimal, replica, logical
- Restart needed
- 是
- Default checked on
- PostgreSQL 18
其作用
minimal writes only what crash recovery needs; replica (default) adds what archiving and physical standbys need; logical adds what logical decoding and logical replication need.
預設值
replica. replica since PostgreSQL 10 (it was minimal before). Same in 18.
Check the current value
SHOW wal_level; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'wal_level';
Change it
ALTER SYSTEM SET wal_level = logical; -- applies only after a server restart
Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When to change it
Set logical before using logical replication, Debezium or another change-data-capture tool. minimal can speed bulk loads into tables created or truncated in the same transaction, but rules out replication and point-in-time recovery.
What can go wrong
Changing it means a restart. logical adds some WAL volume. minimal also requires max_wal_senders = 0 (default 10) and archive_mode = off, or the server refuses to start; existing standbys and base backups stop being usable.
Questions about wal_level
What is the default value of wal_level in PostgreSQL?
replica. replica since PostgreSQL 10 (it was minimal before). Same in 18.
Does changing wal_level require a restart?
Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When should I change wal_level?
Set logical before using logical replication, Debezium or another change-data-capture tool. minimal can speed bulk loads into tables created or truncated in the same transaction, but rules out replication and point-in-time recovery.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check wal_level 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.