{"Entry":{"collection":"guc","key":"wal_init_zero","name":"wal_init_zero","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Write-Ahead Log / Settings","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"11","status":"added","to":"12"}],"content_hash":"27a26592727c092939e339eaa5a01c3258f74522708702bab34cd29250e1de13","context":"","default_changed_in":[],"default_history":[{"from":"12","to":"19","value":"on"}],"editorial":{"advice":{"olap":"Provision WAL, archive bandwidth, and recovery I/O for bulk-load peaks. Coordinate load pacing and checkpoints when reducing spikes; never break the recovery chain for throughput.","oltp":"Establish durability and recovery objectives first, then tune wal_init_zero from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring.","small":"Start from safe defaults and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O."},"mechanism":["Writes zeroes to new WAL files before first use. A superuser or a role granted SET privilege can change it for the relevant session or configuration scope.","With on, newly created WAL segments are zero-filled, which preallocates blocks on many filesystems. Copy-on-write filesystems may turn that work into unnecessary allocation and fragmentation; off still creates a correctly sized file by writing its last byte.","Monitor and change wal_init_zero together with wal_recycle, wal_segment_size, min_wal_size. Validate on the relevant server role and real workload, then use its superuser context to choose session change, reload, or restart; a historical boot default is not the current effective value."],"pitfalls":["Disabling zero-fill on a conventional filesystem and moving allocation stalls into peak WAL creation.","Keeping zero-fill on copy-on-write storage without measuring allocation and fragmentation cost.","Assuming an apparently sparse file means PostgreSQL changed wal_segment_size.","Changing a session value and expecting already-created WAL segments to be rewritten."],"references":[{"title":"PostgreSQL 19 Beta 4: wal_init_zero","url":"https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-WAL-INIT-ZERO"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["wal_recycle","wal_segment_size","min_wal_size","max_wal_size","commit_delay","commit_siblings"],"summary":"wal_init_zero writes zeroes to new WAL files before first use. It is a superuser setting present in PG12–18; the latest recorded boot default is on."},"enumvals":[],"first_version":"12","group":"Write-Ahead Log","group_slug":"wal","imported_at":"2026-09-27T17:57:32.330988+08:00","intro_commit":{"authored_at":"2019-04-02T14:37:14+13:00","discussion":["https://postgr.es/m/CACPQ5Fo00QR7LNAcd1ZjgoBi4y97%2BK760YABs0vQHH5dLdkkMA%40mail.gmail.com"],"hash":"475861b2615dd63ae8431d811749a6f9a15bbfd6","subject":"Add wal_recycle and wal_init_zero GUCs.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=475861b2615dd63ae8431d811749a6f9a15bbfd6"},"key":"wal_init_zero","last_version":"20","max_val":"","min_val":"","name":"wal_init_zero","position":468,"present_in":["12","13","14","15","16","17","18","19","20"],"short_desc":"If set to on (the default), this option causes new WAL files to be filled with zeroes.","short_desc_zh":"","source_rev":"english-manuals:3aa2178fe0a186dd0cfdc2ef37dc6e93ceb28d99478ba4271d2bafa18aa1b9bb","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"wal_init_zero","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"wal_init_zero","SourceRevision":"english-manuals:3aa2178fe0a186dd0cfdc2ef37dc6e93ceb28d99478ba4271d2bafa18aa1b9bb","Facts":{"boot_val":"on","category":"Write-Ahead Log / Settings","context":"superuser","description":"If set to on (the default), this option causes new WAL files to be filled with zeroes. On some file systems, this ensures that space is allocated before we need to write WAL records. However, Copy-On-Write (COW) file systems may not benefit from this technique, so the option is given to skip the unnecessary work. If set to off, only the final byte is written when the file is created so that it has the expected size.","doc":{"anchor":"GUC-WAL-INIT-ZERO","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"wal_init_zero","short_desc":"Writes zeroes to new WAL files before first use.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-WAL-INIT-ZERO","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"wal_init_zero","SourceDatabase":"center","Version":"18","Locale":"en","Title":"wal_init_zero","Summary":"If set to on (the default), this option causes new WAL files to be filled with zeroes. On some file systems, this ensures that space is allocated before we need to write WAL records. However, Copy-On-Write (COW) file systems may not benefit from this technique, so the option is given to skip the unnecessary work. If set to off, only the final byte is written when the file is created so that it has the expected size.","BodyHTML":"\u003cp\u003eIf set to on (the default), this option causes new WAL files to be filled with zeroes. On some file systems, this ensures that space is allocated before we need to write WAL records. However, Copy-On-Write (COW) file systems may not benefit from this technique, so the option is given to skip the unnecessary work. If set to off, only the final byte is written when the file is created so that it has the expected size.\u003c/p\u003e","SourceRevision":"english-manuals:3aa2178fe0a186dd0cfdc2ef37dc6e93ceb28d99478ba4271d2bafa18aa1b9bb","ContentHash":"e69edf972fac1911aebfb181c52a815dcc170dc0375c45b98501537fa802b3fc","Payload":{"description":"If set to on (the default), this option causes new WAL files to be filled with zeroes. On some file systems, this ensures that space is allocated before we need to write WAL records. However, Copy-On-Write (COW) file systems may not benefit from this technique, so the option is given to skip the unnecessary work. If set to off, only the final byte is written when the file is created so that it has the expected size."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
