{"Entry":{"collection":"guc","key":"wal_sync_method","name":"wal_sync_method","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Write-Ahead Log / Settings","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.2","status":"changed","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"15","status":"changed","to":"16"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"01013d197137ffbcc536a005ff002c952c646c5ce9d19d2966571d6d17e68129","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"fdatasync"}],"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_sync_method 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":["Selects the method used for forcing WAL updates to disk. A configuration reload applies a new value; existing work already in flight is not retroactively changed.","This chooses the operating-system primitive used to force WAL to durable storage, such as fdatasync, fsync, or open-sync variants. Availability and performance are platform/filesystem specific; all supported choices preserve the durability contract when the stack is honest.","Monitor and change wal_sync_method together with fsync, full_page_writes, synchronous_commit. 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":["Selecting a method that the operating system or filesystem does not support.","Benchmarking on a different kernel, mount option, or storage cache than production.","Confusing write throughput with durable-sync latency.","Changing the method without a crash/power-loss durability test.","Assuming the fastest method on data files is also the best method for WAL."],"references":[{"title":"PostgreSQL 19 Beta 4: wal_sync_method","url":"https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-WAL-SYNC-METHOD"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["fsync","full_page_writes","synchronous_commit","wal_buffers","wal_writer_delay","commit_delay"],"summary":"wal_sync_method — Selects the method used for forcing WAL updates to disk. Observed in PG9.0–19 Beta 4; its last measured boot default is fdatasync in PG19 Beta 4, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"7.4","group":"Write-Ahead Log","group_slug":"wal","imported_at":"2026-09-27T17:57:32.37907+08:00","intro_commit":{},"key":"wal_sync_method","last_version":"20","max_val":"","min_val":"","name":"wal_sync_method","position":484,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Method used for forcing WAL updates out to disk.","short_desc_zh":"","source_rev":"english-manuals:1e3645af5c56ae3c61b6b7a634f92dd41f8530d49de3521f13bbc0ebdd2cc7fb","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"wal_sync_method","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"wal_sync_method","SourceRevision":"english-manuals:1e3645af5c56ae3c61b6b7a634f92dd41f8530d49de3521f13bbc0ebdd2cc7fb","Facts":{"boot_val":"fdatasync","category":"Write-Ahead Log / Settings","context":"sighup","description":"Method used for forcing WAL updates out to disk. If fsync is off then this setting is irrelevant, since WAL file updates will not be forced out at all. Possible values are: open_datasync (write WAL files with open() option O_DSYNC) fdatasync (call fdatasync() at each commit) fsync (call fsync() at each commit) fsync_writethrough (call fsync() at each commit, forcing write-through of any disk write cache) open_sync (write WAL files with open() option O_SYNC) Not all of these choices are available on all platforms. The default is the first method in the above list that is supported by the platform, except that fdatasync is the default on Linux and FreeBSD. The default is not necessarily ideal; it might be necessary to change this setting or other aspects of your system configuration in order to create a crash-safe configuration or achieve optimal performance. These aspects are discussed in Section 28.1. This parameter can only be set in the postgresql.conf file or on the server command line.","doc":{"anchor":"GUC-WAL-SYNC-METHOD","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"},"documented":true,"enumvals":["fsync","fdatasync","open_sync","open_datasync"],"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"wal_sync_method","short_desc":"Selects the method used for forcing WAL updates to disk.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-WAL-SYNC-METHOD","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"wal_sync_method","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"wal_sync_method","Summary":"","BodyHTML":"\u003cp\u003e用于将 WAL 更新强制写入磁盘的方法。如果\u003ccode\u003efsync\u003c/code\u003e关闭，此设置就没有作用，因为 WAL 文件更新根本不会被强制写入磁盘。可选值为：\u003c/p\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\u003ccode\u003eopen_datasync\u003c/code\u003e（用\u003ccode\u003eopen()\u003c/code\u003e选项\u003ccode\u003eO_DSYNC\u003c/code\u003e写 WAL 文件）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode\u003efdatasync\u003c/code\u003e（在每次提交时调用\u003ccode\u003efdatasync()\u003c/code\u003e）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode\u003efsync\u003c/code\u003e（在每次提交时调用\u003ccode\u003efsync()\u003c/code\u003e）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode\u003efsync_writethrough\u003c/code\u003e（在每次提交时调用\u003ccode\u003efsync()\u003c/code\u003e，强制穿透任何磁盘写缓存）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode\u003eopen_sync\u003c/code\u003e（用\u003ccode\u003eopen()\u003c/code\u003e选项\u003ccode\u003eO_SYNC\u003c/code\u003e写 WAL 文件）\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e不是在所有平台上都能使用所有这些选择。默认值是列表中第一个被平台支持的那个，不过\u003ccode\u003efdatasync\u003c/code\u003e是 Linux 和 FreeBSD 中的默认值。默认值不一定最合适；可能需要更改此设置或系统配置的其他方面，以确保崩溃时的数据安全或达到最佳性能。这些方面在\u003ca href=\"/docs/18/wal-reliability.html\" rel=\"nofollow\"\u003e第 28.1 节\u003c/a\u003e中讨论。这个参数只能在\u003ccode\u003epostgresql.conf\u003c/code\u003e文件中或在服务器命令行上设置。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"85558e1426e28d24f7301300b2e9fb60dc11be2d3393b48d1a47f3c96afe2ea0","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e用于将 WAL 更新强制写入磁盘的方法。如果\u003ccode class=\"varname\"\u003efsync\u003c/code\u003e关闭，此设置就没有作用，因为 WAL 文件更新根本不会被强制写入磁盘。可选值为：\u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eopen_datasync\u003c/code\u003e（用\u003ccode class=\"function\"\u003eopen()\u003c/code\u003e选项\u003ccode class=\"symbol\"\u003eO_DSYNC\u003c/code\u003e写 WAL 文件）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003efdatasync\u003c/code\u003e（在每次提交时调用\u003ccode class=\"function\"\u003efdatasync()\u003c/code\u003e）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003efsync\u003c/code\u003e（在每次提交时调用\u003ccode class=\"function\"\u003efsync()\u003c/code\u003e）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003efsync_writethrough\u003c/code\u003e（在每次提交时调用\u003ccode class=\"function\"\u003efsync()\u003c/code\u003e，强制穿透任何磁盘写缓存）\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eopen_sync\u003c/code\u003e（用\u003ccode class=\"function\"\u003eopen()\u003c/code\u003e选项\u003ccode class=\"symbol\"\u003eO_SYNC\u003c/code\u003e写 WAL 文件）\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e不是在所有平台上都能使用所有这些选择。默认值是列表中第一个被平台支持的那个，不过\u003ccode class=\"literal\"\u003efdatasync\u003c/code\u003e是 Linux 和 FreeBSD 中的默认值。默认值不一定最合适；可能需要更改此设置或系统配置的其他方面，以确保崩溃时的数据安全或达到最佳性能。这些方面在\u003ca href=\"/docs/18/wal-reliability.html\" title=\"28.1. 可靠性\"\u003e第 28.1 节\u003c/a\u003e中讨论。这个参数只能在\u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e文件中或在服务器命令行上设置。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
