RefLib

Reference library for AI

Back

postgresql_16:3.11.4.7 Disable WAL Archival and Streaming Replication

PostgreSQL 16 > The SQL Language > Performance Tips > Populating a Database > Disable WAL Archival and Streaming Replication

When loading large amounts of data into an installation that uses WAL archiving or streaming replication, it might be faster to take a new base backup after the load has completed than to process a large amount of incremental WAL data. To prevent incremental WAL logging while loading, disable archiving and streaming replication, by setting (see guc-wal-level) to minimal, (see guc-archive-mode) to off, and (see guc-max-wal-senders) to zero. But note that changing these settings requires a server restart, and makes any base backups taken before unavailable for archive recovery and standby server, which may lead to data loss.

Aside from avoiding the time for the archiver or WAL sender to process the WAL data, doing this will actually make certain commands faster, because they do not to write WAL at all if wal_level is minimal and the current subtransaction (or top-level transaction) created or truncated the table or index they change. (They can guarantee crash safety more cheaply by doing an fsync at the end than by writing WAL.)

Back