{"Entry":{"collection":"guc","key":"wal_sender_shutdown_timeout","name":"wal_sender_shutdown_timeout","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Replication / Sending Servers","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"18","status":"added","to":"19"}],"content_hash":"43f60f04808f61c7c87ed40c54196e66ffb7bf625468dcbf54267fd7c73a74c1","context":"","default_changed_in":[],"default_history":[{"from":"19","to":"19","value":"-1 ms"}],"derived_content_hash":"4f9626063300b69eb921087c7745eca8b7e60228541d5fff37479a3ab4bda9fd","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218","versions":{"19":"19rc2"}},"editorial":{"advice":{"olap":"Account for large transactions, bulk loads, slow apply, and long-distance links. A short timeout can make shutdown faster but transfer recovery work and inconsistency risk to the next startup.","oltp":"Model normal failover and worst-case lag before setting a bound. Observe sender state, retained WAL, shutdown time, and receiver catch-up; preserve enough capacity for monitoring and planned switchovers.","small":"Use few slots and senders, watch pg_wal disk consumption, and keep timeout behavior explicit. Test shutdown and restart with the receiver both healthy and unavailable."},"mechanism":["PostgreSQL describes wal_sender_shutdown_timeout as follows: “Sets the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver.” It can be changed per session, which makes plan or behavior comparisons possible without changing every workload. The atlas measures it in PG19 Beta 3; boot_val is the compiled or initialized baseline, not proof of a running cluster's effective setting.","During shutdown a sender normally waits until outstanding WAL reaches its receiver. The default -1 waits without a timeout, zero stops immediately, and a positive interval bounds the wait at the cost of possible sender/receiver divergence; connection options can set different policies for physical and logical replication links.","Read it together with wal_sender_timeout, wal_receiver_timeout, synchronous_commit, synchronous_standby_names. Check SHOW and pg_settings on the target server, verify the source and pending_restart fields, and compare workload, logs, and resource metrics before and after any change."],"pitfalls":["Treating the measured boot_val for wal_sender_shutdown_timeout as proof of the effective value on an initialized or managed cluster.","Applying a change as though it were immediate while pg_settings reports user context.","Changing this setting in isolation without checking the linked limits, observability, and rollback path.","Depending on beta behavior in production without retesting the PostgreSQL 19 final release."],"references":[{"title":"PostgreSQL 19 Beta 4: wal_sender_shutdown_timeout","url":"https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-WAL-SENDER-SHUTDOWN-TIMEOUT"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["wal_sender_timeout","wal_receiver_timeout","synchronous_commit","synchronous_standby_names","max_wal_senders"],"summary":"wal_sender_shutdown_timeout — Sets the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver. Observed in PG19 Beta 4; its last measured boot default is -1 ms in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"19","group":"Replication","group_slug":"replication","imported_at":"2026-09-27T17:57:32.367792+08:00","intro_commit":{"authored_at":"2026-04-06T11:35:03+09:00","discussion":["https://postgr.es/m/TYAPR01MB586668E50FC2447AD7F92491F5E89@TYAPR01MB5866.jpnprd01.prod.outlook.com"],"hash":"a8f45dee91768cf1447ffaf2527e499e75a194c3","subject":"Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a8f45dee91768cf1447ffaf2527e499e75a194c3"},"key":"wal_sender_shutdown_timeout","last_version":"20","max_val":"","min_val":"","name":"wal_sender_shutdown_timeout","position":480,"present_in":["19","20"],"repair_provenance":{"original_source_revision":"english-manuals:f6e2e08b7dafa730b2d38e062b91c1e4065bd5ed63b65175f0a168ac3130eefb","receipt_sha256":"db5d744376eea844285a9f89002d0237453032f332c1bc9f9831dd428e90c870","repair":"wiki-repair-20261023"},"short_desc":"Specifies the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver.","short_desc_zh":"","source_rev":"wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"wal_sender_shutdown_timeout","SourceDatabase":"center","Version":"19","SourceTable":"guc","SourceKey":"wal_sender_shutdown_timeout","SourceRevision":"wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218","Facts":{"boot_val":"-1","category":"Replication / Sending Servers","context":"user","description":"Specifies the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver. If this value is specified without units, it is taken as milliseconds. A value of -1 (the default) disables the timeout mechanism, allowing the WAL sender to wait as long as necessary for the receiver to catch up. A value of 0 causes the WAL sender to terminate without waiting for the receiver to catch up. When replication is in use, the sending server normally waits until all WAL data has been transferred to the receiver before completing shutdown. This helps keep sender and receiver in sync after shutdown, which is especially important for physical replication switchovers, but it can delay shutdown. If this parameter is set to zero or a positive value, the server stops waiting and completes shutdown when the timeout expires. This can shorten shutdown time, for example, when replication is slow on high-latency networks or when a logical replication apply worker is blocked waiting for locks. However, in this case the sender and receiver may be out of sync after shutdown. Care should be taken to select a value high enough to allow all WAL data to be replicated to the receiver under normal circumstances. This parameter can be set in primary_conninfo and in the CONNECTION clause of CREATE SUBSCRIPTION (for example, include options=-cwal_sender_shutdown_timeout=10s in the connection string), allowing different timeouts per replication connection. For example, when both physical and logical replication are used, it can be disabled for physical replication (e.g., for switchovers) while enabled for logical replication to limit shutdown time.","description_zh":"指定服务器在关闭期间等待所有 WAL 数据复制到接收端的最长时间。如果此值未指定单位，则按毫秒计。值 -1（默认值）会禁用超时机制，允许 WAL 发送进程根据需要一直等待接收端追赶。值 0 会使 WAL 发送进程不等待接收端追赶便终止。 使用复制时，发送服务器通常会等待直到所有 WAL 数据都已传输到接收端，才完成关闭。这有助于在关闭后保持发送端和接收端同步，这对于物理复制切换尤其重要，但也可能延迟关闭。 如果此参数设置为零或正值，则超时到达时服务器会停止等待并完成关闭。这可以缩短关闭时间，例如在高延迟网络上复制较慢，或者逻辑复制应用工作进程因等待锁而阻塞时。不过在这种情况下，关闭后发送端和接收端可能不同步。应谨慎选择足够大的值，以便在正常情况下让所有 WAL 数据都能复制到接收端。 该参数可以在 primary_conninfo 中以及 CREATE SUBSCRIPTION 的 CONNECTION 子句中设置（例如在连接串中包含 options=-cwal_sender_shutdown_timeout=10s），从而为不同的复制连接设置不同的超时时间。例如，同时使用物理复制和逻辑复制时，可以对物理复制禁用该超时（例如用于切换），而对逻辑复制启用它以限制关闭时间。","description_zh_html":"\u003cp\u003e\n        指定服务器在关闭期间等待所有 WAL 数据复制到接收端的最长时间。如果此值未指定单位，则按毫秒计。值 \u003ccode class=\"literal\"\u003e-1\u003c/code\u003e（默认值）会禁用超时机制，允许 WAL 发送进程根据需要一直等待接收端追赶。值 \u003ccode class=\"literal\"\u003e0\u003c/code\u003e 会使\n        WAL 发送进程不等待接收端追赶便终止。\n       \u003c/p\u003e\u003cp\u003e\n        使用复制时，发送服务器通常会等待直到所有 WAL 数据都已传输到接收端，才完成关闭。这有助于在关闭后保持发送端和接收端同步，这对于物理复制切换尤其重要，但也可能延迟关闭。\n       \u003c/p\u003e\u003cp\u003e\n        如果此参数设置为零或正值，则超时到达时服务器会停止等待并完成关闭。这可以缩短关闭时间，例如在高延迟网络上复制较慢，或者逻辑复制应用工作进程因等待锁而阻塞时。不过在这种情况下，关闭后发送端和接收端可能不同步。应谨慎选择足够大的值，以便在正常情况下让所有 WAL 数据都能复制到接收端。\n       \u003c/p\u003e\u003cp\u003e\n        该参数可以在 \u003ccode class=\"varname\"\u003eprimary_conninfo\u003c/code\u003e 中以及\n        \u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e 的 \u003ccode class=\"literal\"\u003eCONNECTION\u003c/code\u003e 子句中设置（例如在连接串中包含 \u003ccode class=\"literal\"\u003eoptions=-cwal_sender_shutdown_timeout=10s\u003c/code\u003e），从而为不同的复制连接设置不同的超时时间。例如，同时使用物理复制和逻辑复制时，可以对物理复制禁用该超时（例如用于切换），而对逻辑复制启用它以限制关闭时间。\n       \u003c/p\u003e","doc":{"anchor":"GUC-WAL-SENDER-SHUTDOWN-TIMEOUT","file":"runtime-config-replication.html","lang":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","slug":"19"},"doc_html":"\u003cp\u003e\n        Specifies the maximum time the server waits during shutdown for all\n        WAL data to be replicated to the receiver.  If this value is specified\n        without units, it is taken as milliseconds.  A value of\n        \u003ccode class=\"literal\"\u003e-1\u003c/code\u003e (the default) disables the timeout mechanism,\n        allowing the WAL sender to wait as long as necessary for the receiver\n        to catch up.  A value of \u003ccode class=\"literal\"\u003e0\u003c/code\u003e causes the WAL sender to\n        terminate without waiting for the receiver to catch up.\n       \u003c/p\u003e\u003cp\u003e\n        When replication is in use, the sending server normally waits until\n        all WAL data has been transferred to the receiver before completing\n        shutdown.  This helps keep sender and receiver in sync after shutdown,\n        which is especially important for physical replication switchovers,\n        but it can delay shutdown.\n       \u003c/p\u003e\u003cp\u003e\n        If this parameter is set to zero or a positive value, the server stops\n        waiting and completes shutdown when the timeout expires.  This can\n        shorten shutdown time, for example, when replication is slow on\n        high-latency networks or when a logical replication apply worker is\n        blocked waiting for locks.  However, in this case the sender and\n        receiver may be out of sync after shutdown.  Care should be taken to\n        select a value high enough to allow all WAL data to be replicated to\n        the receiver under normal circumstances.\n       \u003c/p\u003e\u003cp\u003e\n        This parameter can be set in \u003ccode class=\"varname\"\u003eprimary_conninfo\u003c/code\u003e and\n        in the \u003ccode class=\"literal\"\u003eCONNECTION\u003c/code\u003e clause of\n        \u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e (for example, include\n        \u003ccode class=\"literal\"\u003eoptions=-cwal_sender_shutdown_timeout=10s\u003c/code\u003e in the\n        connection string), allowing different timeouts per replication\n        connection.  For example, when both physical and logical replication\n        are used, it can be disabled for physical replication (e.g., for\n        switchovers) while enabled for logical replication to limit shutdown\n        time.\n       \u003c/p\u003e","doc_same_as":"","documentation_revision":{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","version":"19rc2"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"935f29b71e863329c3c39caae902de37d5bbf03c2adcf42322225d3cefe71a84","version":"19rc2"}],"release":"19rc2","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"documented":true,"enumvals":null,"extra_desc":"-1 means wait indefinitely. 0 means do not wait.","lang":"en","max_val":"2147483647","metadata_version":"19beta4","min_val":"-1","name":"wal_sender_shutdown_timeout","short_desc":"Sets the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/19/html/runtime-config-replication.html","sha256":"13604910cbd148ee7ce28b864a8b369c7396eba95fdc2b30200cb2526e014d99"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"19"},"unit":"ms","vartype":"integer","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-WAL-SENDER-SHUTDOWN-TIMEOUT","file":"runtime-config-replication.html","lang":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","slug":"19"}},"MeasuredEvidence":{"metadata_version":"19beta4"}},"Text":{"Collection":"guc","Key":"wal_sender_shutdown_timeout","SourceDatabase":"center","Version":"19","Locale":"en","Title":"wal_sender_shutdown_timeout","Summary":"Specifies the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver. If this value is specified without units, it is taken as milliseconds. A value of -1 (the default) disables the timeout mechanism, allowing the WAL sender to wait as long as necessary for the receiver to catch up. A value of 0 causes the WAL sender to terminate without waiting for the receiver to catch up. When replication is in use, the sending server normally waits until all WAL data has been transferred to the receiver before completing shutdown. This helps keep sender and receiver in sync after shutdown, which is especially important for physical replication switchovers, but it can delay shutdown. If this parameter is set to zero or a positive value, the server stops waiting and completes shutdown when the timeout expires. This can shorten shutdown time, for example, when replication is slow on high-latency networks or when a logical replication apply worker is blocked waiting for locks. However, in this case the sender and receiver may be out of sync after shutdown. Care should be taken to select a value high enough to allow all WAL data to be replicated to the receiver under normal circumstances. This parameter can be set in primary_conninfo and in the CONNECTION clause of CREATE SUBSCRIPTION (for example, include options=-cwal_sender_shutdown_timeout=10s in the connection string), allowing different timeouts per replication connection. For example, when both physical and logical replication are used, it can be disabled for physical replication (e.g., for switchovers) while enabled for logical replication to limit shutdown time.","BodyHTML":"\u003cp\u003e\n        Specifies the maximum time the server waits during shutdown for all\n        WAL data to be replicated to the receiver.  If this value is specified\n        without units, it is taken as milliseconds.  A value of\n        \u003ccode\u003e-1\u003c/code\u003e (the default) disables the timeout mechanism,\n        allowing the WAL sender to wait as long as necessary for the receiver\n        to catch up.  A value of \u003ccode\u003e0\u003c/code\u003e causes the WAL sender to\n        terminate without waiting for the receiver to catch up.\n       \u003c/p\u003e\u003cp\u003e\n        When replication is in use, the sending server normally waits until\n        all WAL data has been transferred to the receiver before completing\n        shutdown.  This helps keep sender and receiver in sync after shutdown,\n        which is especially important for physical replication switchovers,\n        but it can delay shutdown.\n       \u003c/p\u003e\u003cp\u003e\n        If this parameter is set to zero or a positive value, the server stops\n        waiting and completes shutdown when the timeout expires.  This can\n        shorten shutdown time, for example, when replication is slow on\n        high-latency networks or when a logical replication apply worker is\n        blocked waiting for locks.  However, in this case the sender and\n        receiver may be out of sync after shutdown.  Care should be taken to\n        select a value high enough to allow all WAL data to be replicated to\n        the receiver under normal circumstances.\n       \u003c/p\u003e\u003cp\u003e\n        This parameter can be set in \u003ccode\u003eprimary_conninfo\u003c/code\u003e and\n        in the \u003ccode\u003eCONNECTION\u003c/code\u003e clause of\n        \u003ccode\u003eCREATE SUBSCRIPTION\u003c/code\u003e (for example, include\n        \u003ccode\u003eoptions=-cwal_sender_shutdown_timeout=10s\u003c/code\u003e in the\n        connection string), allowing different timeouts per replication\n        connection.  For example, when both physical and logical replication\n        are used, it can be disabled for physical replication (e.g., for\n        switchovers) while enabled for logical replication to limit shutdown\n        time.\n       \u003c/p\u003e","SourceRevision":"wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218","ContentHash":"f5c08bdaa8f18ae70628839df453cc7463c0f2b8d1210f46e247dbfb385d4ca5","Payload":{"description":"Specifies the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver. If this value is specified without units, it is taken as milliseconds. A value of -1 (the default) disables the timeout mechanism, allowing the WAL sender to wait as long as necessary for the receiver to catch up. A value of 0 causes the WAL sender to terminate without waiting for the receiver to catch up. When replication is in use, the sending server normally waits until all WAL data has been transferred to the receiver before completing shutdown. This helps keep sender and receiver in sync after shutdown, which is especially important for physical replication switchovers, but it can delay shutdown. If this parameter is set to zero or a positive value, the server stops waiting and completes shutdown when the timeout expires. This can shorten shutdown time, for example, when replication is slow on high-latency networks or when a logical replication apply worker is blocked waiting for locks. However, in this case the sender and receiver may be out of sync after shutdown. Care should be taken to select a value high enough to allow all WAL data to be replicated to the receiver under normal circumstances. This parameter can be set in primary_conninfo and in the CONNECTION clause of CREATE SUBSCRIPTION (for example, include options=-cwal_sender_shutdown_timeout=10s in the connection string), allowing different timeouts per replication connection. For example, when both physical and logical replication are used, it can be disabled for physical replication (e.g., for switchovers) while enabled for logical replication to limit shutdown time."}},"RequestedLocale":"en","Fallback":false,"Versions":["19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
