DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Settings

wal_level

Sets the level of information written to the WAL.

  • Default: replica
  • Type: enum
  • Values: minimal · replica · logical
  • Applies: Restart required

In plain words

Every change is first written to the write-ahead log (WAL). wal_level decides how much detail goes in. minimal is just enough to survive a crash. replica (the default) adds what standbys and point-in-time recovery need. logical adds even more so changes can be decoded into rows for logical replication.

Higher levels write a bit more WAL. Going below replica breaks backups and replicas.

For DBAs and operators

minimal skips WAL for some bulk operations when the table was created or truncated in the same transaction (CREATE TABLE AS, COPY into a new table, CREATE INDEX, CLUSTER): the files are fsynced at commit instead (see wal_skip_threshold). It requires max_wal_senders = 0 and archive_mode = off, and pg_basebackup, streaming, archiving and summarize_wal are all unavailable. WAL produced at minimal can never be used for PITR; a base backup taken before switching is useless afterwards.

replica also logs the information needed to run read-only queries on a hot standby (running-xacts snapshots, AccessExclusiveLock records). This is what physical replication, pg_basebackup and PITR need.

logical adds the old key columns for UPDATE/DELETE (per REPLICA IDENTITY), catalog-related information and combo-CID records. Expect a modest WAL increase, larger with REPLICA IDENTITY FULL. Required for logical slots, publications/subscriptions and for sync_replication_slots on a standby.

Support notes

  • Archive recovery or a standby that meets WAL generated at minimal stops: FATAL: WAL was generated with "wal_level=minimal", cannot continue recovering
  • Trying to create a logical slot at replica: ERROR: logical decoding requires "wal_level" >= "logical"
  • The value is recorded in pg_control (pg_controldata | grep wal_level).

How to change it

Change in postgresql.conf or ALTER SYSTEM, then restart the server.

See it in context

Write-ahead log (WAL) Logical replication Streaming replication Archiving and point-in-time recovery Archiver WAL sender WAL summarizer Logical decoding and ReorderBuffer

Related parameters

max_wal_senders archive_mode wal_skip_threshold summarize_wal max_replication_slots

All Write-Ahead Log parameters