{"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"}],"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"],"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":"english-manuals:f6e2e08b7dafa730b2d38e062b91c1e4065bd5ed63b65175f0a168ac3130eefb","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"wal_sender_shutdown_timeout","SourceDatabase":"center","Version":"20","SourceTable":"guc","SourceKey":"wal_sender_shutdown_timeout","SourceRevision":"english-manuals:f6e2e08b7dafa730b2d38e062b91c1e4065bd5ed63b65175f0a168ac3130eefb","Facts":{"boot_val":null,"category":"Sending Servers","context":"","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.","doc":{"anchor":"GUC-WAL-SENDER-SHUTDOWN-TIMEOUT","file":"runtime-config-replication.html","lang":"en","sha256":"5170b5139753c7441f6fd08cbfe72a6ddbff25b9b340bfb6a73f70d2d32c2ca3","slug":"devel"},"documented":true,"enumvals":[],"extra_desc":"","lang":"en","max_val":null,"metadata_version":"","min_val":null,"name":"wal_sender_shutdown_timeout","short_desc":"","source":"english-manual","unit":"","vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-WAL-SENDER-SHUTDOWN-TIMEOUT","file":"runtime-config-replication.html","lang":"en","sha256":"5170b5139753c7441f6fd08cbfe72a6ddbff25b9b340bfb6a73f70d2d32c2ca3","slug":"devel"}},"MeasuredEvidence":{"metadata_version":""}},"Text":{"Collection":"guc","Key":"wal_sender_shutdown_timeout","SourceDatabase":"center","Version":"20","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\u003eSpecifies 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.\u003c/p\u003e","SourceRevision":"english-manuals:f6e2e08b7dafa730b2d38e062b91c1e4065bd5ed63b65175f0a168ac3130eefb","ContentHash":"bbe86d74f1d5cefcbda14f05ff2e86dab8bd54ff323578392674d077ae9f511e","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":"zh-Hans","Fallback":true,"Versions":["19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
