postgresql_16:6.14 Archive Modules
PostgreSQL 16 > Server Programming > Archive Modules
PostgreSQL provides infrastructure to create custom modules for continuous archiving (see (see postgresql_16:4.11.3)). While archiving via a shell command (i.e., (see guc-archive-command)) is much simpler, a custom archive module will often be considerably more robust and performant.
When a custom (see guc-archive-library) is configured, PostgreSQL will submit completed WAL files to the module, and the server will avoid recycling or removing these WAL files until the module indicates that the files were successfully archived. It is ultimately up to the module to decide what to do with each WAL file, but many recommendations are listed at (see postgresql_16:4.11.3.1).
Archiving modules must at least consist of an initialization function (see (see postgresql_16:6.14.1)) and the required callbacks (see (see postgresql_16:6.14.2)). However, archive modules are also permitted to do much more (e.g., declare GUCs and register background workers).
The contrib/basic_archive module contains a working example, which demonstrates some useful techniques.
Subsections
- postgresql_16:6.14.1 Initialization Functions
- postgresql_16:6.14.2 Archive Module Callbacks