{"Entry":{"collection":"guc","key":"archive_library","name":"archive_library","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Write-Ahead Log / Archiving","category_zh":"","changed_in":["18"],"changes":[{"documentation_changed":false,"fields":{},"from":"14","status":"added","to":"15"},{"documentation_changed":true,"fields":{},"from":"15","status":"changed","to":"16"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":false,"fields":{"extra_desc":{"from":"An empty string indicates that \"archive_command\" should be used.","to":"An empty string means use \"archive_command\"."}},"from":"17","status":"changed","to":"18"}],"content_hash":"77a4d7333537474509021a4148c7b3ec86ec6f2e1d77141f6dd489a70ce884a7","context":"","default_changed_in":[],"default_history":[{"from":"15","to":"19","value":"Empty string"}],"editorial":{"advice":{"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.","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.","small":"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."},"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."],"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."],"references":[{"title":"PostgreSQL 19 Beta 4: archive_library","url":"https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-ARCHIVE-LIBRARY"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["archive_mode","archive_command","archive_timeout","archive_cleanup_command","restore_command","recovery_end_command"],"summary":"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."},"enumvals":[],"first_version":"15","group":"Write-Ahead Log","group_slug":"wal","imported_at":"2026-09-27T17:57:30.758027+08:00","intro_commit":{"authored_at":"2022-02-03T13:57:27-05:00","discussion":["https://postgr.es/m/20220202224433.GA1036711@nathanxps13"],"hash":"5ef1eefd76f404ddc59b885d50340e602b70f05f","subject":"Allow archiving via loadable modules.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=5ef1eefd76f404ddc59b885d50340e602b70f05f"},"key":"archive_library","last_version":"20","max_val":"","min_val":"","name":"archive_library","position":10,"present_in":["15","16","17","18","19","20"],"short_desc":"The library to use for archiving completed WAL file segments.","short_desc_zh":"","source_rev":"english-manuals:74b42ea6e9be16f3b47c7b4ca26b6bbb66b7c114405fc162b8c64186eeac3f4f","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"archive_library","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"archive_library","SourceRevision":"english-manuals:74b42ea6e9be16f3b47c7b4ca26b6bbb66b7c114405fc162b8c64186eeac3f4f","Facts":{"boot_val":"","category":"Write-Ahead Log / Archiving","context":"sighup","description":"The library to use for archiving completed WAL file segments. If set to an empty string (the default), archiving via shell is enabled, and archive_command is used. If both archive_command and archive_library are set, an error will be raised. Otherwise, the specified shared library is used for archiving. The WAL archiver process is restarted by the postmaster when this parameter changes. For more information, see Section 25.3.1 and Chapter 49. This parameter can only be set in the postgresql.conf file or on the server command line.","doc":{"anchor":"GUC-ARCHIVE-LIBRARY","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"An empty string means use \"archive_command\".","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"archive_library","short_desc":"Sets the library that will be called to archive a WAL file.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-ARCHIVE-LIBRARY","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"archive_library","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"archive_library","Summary":"","BodyHTML":"\u003cp\u003e用于归档已完成的WAL段文件的库。如果设置为空字符串（默认值），则通过shell进行归档，并使用\u003ca href=\"/docs/18/runtime-config-wal.html#GUC-ARCHIVE-COMMAND\" rel=\"nofollow\"\u003earchive_command\u003c/a\u003e。如果\u003ccode\u003earchive_command\u003c/code\u003e和\u003ccode\u003earchive_library\u003c/code\u003e都被设置，则会报错。否则，指定的共享库用于归档。当此参数更改时，postmaster会重新启动WAL归档进程。有关更多信息，请参见\u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-ARCHIVING-WAL\" rel=\"nofollow\"\u003e第 25.3.1 节\u003c/a\u003e和\u003ca href=\"/docs/18/archive-modules.html\" rel=\"nofollow\"\u003e第 49 章\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e这个参数只能在\u003ccode\u003epostgresql.conf\u003c/code\u003e文件中或者服务器命令行中设置。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"98517a66766df46cf1f5a26d2510f9c7ad092ecff707af236b817975e6c1f4d3","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e用于归档已完成的WAL段文件的库。如果设置为空字符串（默认值），则通过shell进行归档，并使用\u003ca href=\"/docs/18/runtime-config-wal.html#GUC-ARCHIVE-COMMAND\"\u003earchive_command\u003c/a\u003e。如果\u003ccode class=\"varname\"\u003earchive_command\u003c/code\u003e和\u003ccode class=\"varname\"\u003earchive_library\u003c/code\u003e都被设置，则会报错。否则，指定的共享库用于归档。当此参数更改时，postmaster会重新启动WAL归档进程。有关更多信息，请参见\u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-ARCHIVING-WAL\" title=\"25.3.1. 设置 WAL 归档\"\u003e第 25.3.1 节\u003c/a\u003e和\u003ca href=\"/docs/18/archive-modules.html\" title=\"第 49 章 归档模块\"\u003e第 49 章\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e这个参数只能在\u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e文件中或者服务器命令行中设置。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
