{"Entry":{"collection":"guc","key":"max_parallel_apply_workers_per_subscription","name":"max_parallel_apply_workers_per_subscription","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Replication / Subscribers","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"15","status":"added","to":"16"}],"content_hash":"930b727924df1924ba9760f5d83c8443140a3bdf84739e156cd29f23ce44b56b","context":"","default_changed_in":[],"default_history":[{"from":"16","to":"19","value":"2"}],"editorial":{"advice":{"olap":"Read standbys and logical subscribers often see long queries or large transactions. Put explicit bounds on replay/apply and monitor lag, worker saturation, slot restart_lsn, and conflict cancellations.","oltp":"Size max_parallel_apply_workers_per_subscription from topology, failover roles, slot/subscription count, and reconnect headroom. Test worst-case primary latency, standby replay, and disk retention before production.","small":"Configure only replication capacity that is actually used. Even a small topology needs bounded timeouts and slot lifecycle; unlimited retention is not reliability."},"mechanism":["Maximum number of parallel apply workers per subscription. A configuration reload applies a new value; existing work already in flight is not retroactively changed.","A subscription leader can use up to this many parallel workers to apply suitable in-progress transactions. More workers do not parallelize every transaction and consume the global logical-replication and background-worker pools.","Monitor and change max_parallel_apply_workers_per_subscription together with max_logical_replication_workers, max_sync_workers_per_subscription, max_worker_processes. 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":["Changing it on the wrong primary, standby, sender, or subscriber role.","Watching only configured bytes/time instead of actual lag, slot position, and worker state.","Failing over to a node that lacks the old primary's capacity or prerequisites.","Using infinite waits or WAL retention to hide a failed consumer."],"references":[{"title":"PostgreSQL 19 Beta 4: max_parallel_apply_workers_per_subscription","url":"https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["max_logical_replication_workers","max_sync_workers_per_subscription","max_worker_processes","max_replication_slots","max_active_replication_origins","hot_standby"],"summary":"max_parallel_apply_workers_per_subscription sets the maximum number of parallel apply workers per subscription. It is a sighup setting present in PG16–18; the latest recorded boot default is 2."},"enumvals":[],"first_version":"16","group":"Replication","group_slug":"replication","imported_at":"2026-09-27T17:57:31.709648+08:00","intro_commit":{"authored_at":"2023-01-09T07:00:39+05:30","discussion":["https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com"],"hash":"216a784829c2c5f03ab0c43e009126cbb819e9b2","subject":"Perform apply of large transactions by parallel workers.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=216a784829c2c5f03ab0c43e009126cbb819e9b2"},"key":"max_parallel_apply_workers_per_subscription","last_version":"20","max_val":"","min_val":"","name":"max_parallel_apply_workers_per_subscription","position":273,"present_in":["16","17","18","19","20"],"short_desc":"Maximum number of parallel apply workers per subscription.","short_desc_zh":"","source_rev":"english-manuals:eef1f75da6fd4b2fe38f5fddb58a45b94a7827566fe4ff886f378659aec2e1dc","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"max_parallel_apply_workers_per_subscription","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"max_parallel_apply_workers_per_subscription","SourceRevision":"english-manuals:eef1f75da6fd4b2fe38f5fddb58a45b94a7827566fe4ff886f378659aec2e1dc","Facts":{"boot_val":"2","category":"Replication / Subscribers","context":"sighup","description":"Maximum number of parallel apply workers per subscription. This parameter controls the amount of parallelism for streaming of in-progress transactions with subscription parameter streaming = parallel. The parallel apply workers are taken from the pool defined by max_logical_replication_workers. The default value is 2. This parameter can only be set in the postgresql.conf file or on the server command line.","doc":{"anchor":"GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"1024","metadata_version":"18","min_val":"0","name":"max_parallel_apply_workers_per_subscription","short_desc":"Maximum number of parallel apply workers per subscription.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"max_parallel_apply_workers_per_subscription","SourceDatabase":"center","Version":"18","Locale":"en","Title":"max_parallel_apply_workers_per_subscription","Summary":"Maximum number of parallel apply workers per subscription. This parameter controls the amount of parallelism for streaming of in-progress transactions with subscription parameter streaming = parallel. The parallel apply workers are taken from the pool defined by max_logical_replication_workers. The default value is 2. This parameter can only be set in the postgresql.conf file or on the server command line.","BodyHTML":"\u003cp\u003eMaximum number of parallel apply workers per subscription. This parameter controls the amount of parallelism for streaming of in-progress transactions with subscription parameter streaming = parallel. The parallel apply workers are taken from the pool defined by max_logical_replication_workers. The default value is 2. This parameter can only be set in the postgresql.conf file or on the server command line.\u003c/p\u003e","SourceRevision":"english-manuals:eef1f75da6fd4b2fe38f5fddb58a45b94a7827566fe4ff886f378659aec2e1dc","ContentHash":"58adb27c55bfb93c924c0bac2ee780c3aae1c873f5e8f3fda7886c8cad55bcc0","Payload":{"description":"Maximum number of parallel apply workers per subscription. This parameter controls the amount of parallelism for streaming of in-progress transactions with subscription parameter streaming = parallel. The parallel apply workers are taken from the pool defined by max_logical_replication_workers. The default value is 2. This parameter can only be set in the postgresql.conf file or on the server command line."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
