wal_level
Read PG 18 manual ↗wal_level determines how much information is written to the WAL.
- Type
- enum
- Context
- postmaster
- Measured default
- replica
- Unit
- —
- Metadata snapshot
- 18
- Allowed values
- minimal, replica, logical
Definition PG 18 manual
wal_level determines how much information is written to the WAL. The default value is replica, which writes enough data to support WAL archiving and replication, including running read-only queries on a standby server. minimal removes all logging except the information required to recover from a crash or immediate shutdown. Finally, logical adds information necessary to support logical decoding. Each level includes the information logged at all lower levels. This parameter can only be set at server start.
The minimal level generates the least WAL volume. It logs no row information for permanent relations in transactions that create or rewrite them. This can make operations much faster (see Section 14.4.7). Operations that initiate this optimization include:
ALTER ... SET TABLESPACE |
CLUSTER |
CREATE TABLE |
REFRESH MATERIALIZED VIEW (without CONCURRENTLY) |
REINDEX |
TRUNCATE |
However, minimal WAL does not contain sufficient information for point-in-time recovery, so replica or higher must be used to enable continuous archiving (archive_mode) and streaming binary replication. In fact, the server will not even start in this mode if max_wal_senders is non-zero. Note that changing wal_level to minimal makes previous base backups unusable for point-in-time recovery and standby servers.
In logical level, the same information is logged as with replica, plus information needed to extract logical change sets from the WAL. Using a level of logical will increase the WAL volume, particularly if many tables are configured for REPLICA IDENTITY FULL and many UPDATE and DELETE statements are executed.
In releases prior to 9.6, this parameter also allowed the values archive and hot_standby. These are still accepted but mapped to replica.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 9.6 | minimal |
| 10 – 19 | replica |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
Sets the level of information written to the WAL. The value is fixed when the server starts, so changing it requires a restart.
minimal logs only crash-recovery needs and is incompatible with archiving/streaming modes that require replica data; replica supports physical replication and archive recovery; logical adds logical-decoding information. Changing level requires restart and may change WAL volume.
Monitor and change wal_level together with wal_compression, full_page_writes, wal_log_hints. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Operational considerations
Selecting minimal while expecting archiving, streaming replication, or logical decoding.
Raising it without budgeting extra WAL and restart downtime.
Lowering it while slots/subscriptions still depend on the higher level.
Confusing pg_settings base units with human-readable configuration units.
Benchmarking throughput without a crash-recovery and archive-restore test.
Workload guidance
OLAP: Provision WAL, archive bandwidth, and recovery I/O for bulk-load peaks. Coordinate load pacing and checkpoints when reducing spikes; never break the recovery chain for throughput.
OLTP: Establish durability and recovery objectives first, then tune wal_level from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring.
SMALL: Start from safe defaults and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O.
Version history 7
- PG 18 → 19changed
- PG 13 → 14changed
- PG 12 → 13changed
- PG 9.6 → 10changed
- PG 9.5 → 9.6changed
- PG 9.4 → 9.5changed
- PG 9.3 → 9.4changed
Related entries
Further reading
Definition snapshot: english-manuals:1b84d995713797780e4d4caac0b… · English manual source