Parameter · Write-Ahead Log / Archiving
archive_library
Sets the library that will be called to archive a WAL file. An empty string means use "archive_command".
- Default:
'' (empty) - Type: string
- Applies: Reload
In plain words
Instead of starting a shell command for every WAL file, PostgreSQL can load an archive module (a shared library) into the archiver process and call it directly. That is faster and lets the module keep state. archive_library names the module; empty means "use archive_command".
For DBAs and operators
Added in PostgreSQL 15. The archiver loads the library and calls its archive callback for each segment; the callback returns true when the file is safely archived. The contrib module basic_archive is a reference implementation:
archive_mode = on
archive_library = 'basic_archive'
basic_archive.archive_directory = '/mnt/archive'- Changing it with a reload restarts the archiver process.
- Setting both this and
archive_commandis an error: FATAL: both "archive_command" and "archive_library" set - Same contract as a command: report success only once the file is durable; failures are retried and WAL accumulates.
- Besides the archive callback, a module can provide startup, "is it configured?" and shutdown callbacks. Third-party backup tools may ship modules.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().