# archive_library

> archive_library sets the library that will be called to archive a WAL file. It is a sighup setting present in PG15–18; the latest recorded boot default is empty.
---

> [!NOTE]
> **Fact — official short description:** “Sets the library that will be called to archive a WAL file.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `string` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Write-Ahead Log / Archiving | Upstream classification |
| Latest boot value | `""` | empty string |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG15 |
| Present in | PG15–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`5ef1eefd76f4`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=5ef1eefd76f404ddc59b885d50340e602b70f05f) — Allow archiving via loadable modules. |
| Commit date | 2022-02-03 |
| Discussion | [thread 1](https://postgr.es/m/20220202224433.GA1036711@nathanxps13) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG15–19 Beta 3 | `""` | — | empty string |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

Sets the library that will be called to archive a WAL file. A configuration reload applies a new value; existing work already in flight is not retroactively changed.

A nonempty library selects an archive module through its _PG_archive_module_init callback instead of a shell command. archive_command and archive_library are alternative implementations; changing either is reloadable, while archive_mode must already be active.

Monitor and change archive_library together with archive_mode, archive_command, archive_timeout. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Manage archive_library as part of the backup/restore protocol: the command or module must be idempotent, fail visibly, and be verified by restoring from the real archive—not merely by exit status. |
| OLAP | Provision archive throughput and capacity for bulk-load WAL peaks. If archiving falls behind, throttle the job and alert; never hide backlog with false success or aggressive cleanup. |
| Small nodes | Enable it only for a defined PITR requirement and use a mature backup tool. Keep rebuildable instances simple, but never install a no-op command that creates the illusion of a backup. |
{.full-width}

## Pigsty {#pigsty}

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

| Template | Effective value | Versus upstream boot | Source expression |
| --- | --- | --- | --- |
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG15–19 Beta 3 unmodified; OLAP: PG15–19 Beta 3 unmodified; CRIT: PG15–19 Beta 3 unmodified; TINY: PG15–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

## Common pitfalls {#common-pitfalls}

- Configuring both a library and expecting archive_command to run as a fallback.
- Loading untrusted in-process archive code.
- Treating module success as proof that restores work.
- Reloading to a new module without verifying backlog processing, failure reporting, and rollback behavior.
- Letting repeated module failures retain WAL until pg_wal fills, without an archive-lag alert.

## Related parameters {#related-parameters}

[`archive_mode`](/parameters/archive-mode/) · [`archive_command`](/parameters/archive-command/) · [`archive_timeout`](/parameters/archive-timeout/) · [`archive_cleanup_command`](/parameters/archive-cleanup-command/) · [`restore_command`](/parameters/restore-command/) · [`recovery_end_command`](/parameters/recovery-end-command/)

## References {#references}

- [PostgreSQL 19 Beta 3 — archive_library](https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-ARCHIVE-LIBRARY)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
