{"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"}],"derived_content_hash":"62367cb24e04423c655994451d1a626f4711104af25e82c16f187c9dde8af549","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:d23549af9da950894a2095bb509b9b01ed448f441e6fd498bfa35d5894726cf2","versions":{"16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"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"],"repair_provenance":{"original_source_revision":"english-manuals:eef1f75da6fd4b2fe38f5fddb58a45b94a7827566fe4ff886f378659aec2e1dc","receipt_sha256":"ad9f013c7c978d8a6c6d9ee510e6c8e1a1d7283d29eb997c4d21d25ab86d9c7a","repair":"wiki-repair-20261023"},"short_desc":"Maximum number of parallel apply workers per subscription.","short_desc_zh":"","source_rev":"wiki-repair-20261023:d23549af9da950894a2095bb509b9b01ed448f441e6fd498bfa35d5894726cf2","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":"wiki-repair-20261023:d23549af9da950894a2095bb509b9b01ed448f441e6fd498bfa35d5894726cf2","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.","description_zh":"每个订阅可使用的并行应用工作进程最大数。该参数控制订阅设置为 streaming = parallel 时，对流式传入的进行中事务进行并行应用的程度。 并行应用工作进程来自 max_logical_replication_workers 定义的进程池。 默认值是 2。此参数只能在 postgresql.conf 文件中或服务器命令行上设置。","description_zh_html":"\u003cp\u003e\n\t        每个订阅可使用的并行应用工作进程最大数。该参数控制订阅设置为\n\t        \u003ccode class=\"literal\"\u003estreaming = parallel\u003c/code\u003e 时，对流式传入的进行中事务进行并行应用的程度。\n\t       \u003c/p\u003e\u003cp\u003e\n\t        并行应用工作进程来自 \u003ccode class=\"varname\"\u003emax_logical_replication_workers\u003c/code\u003e 定义的进程池。\n\t       \u003c/p\u003e\u003cp\u003e\n\t        默认值是 2。此参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件中或服务器命令行上设置。\n\t       \u003c/p\u003e","doc":{"anchor":"GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION","file":"runtime-config-replication.html","lang":"en","sha256":"c0b8bd86131ec62d4df97ce480d004aa7e3544477d053f0c2d4047b9edad5cc0","slug":"18"},"doc_html":"\u003cp\u003e\n        Maximum number of parallel apply workers per subscription. This\n        parameter controls the amount of parallelism for streaming of\n        in-progress transactions with subscription parameter\n        \u003ccode class=\"literal\"\u003estreaming = parallel\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The parallel apply workers are taken from the pool defined by\n        \u003ccode class=\"varname\"\u003emax_logical_replication_workers\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The default value is 2. This parameter can only be set in the\n        \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e file or on the server command\n        line.\n       \u003c/p\u003e","doc_same_as":"","documentation_revision":{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"c0b8bd86131ec62d4df97ce480d004aa7e3544477d053f0c2d4047b9edad5cc0","version":"18.7"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"83907b5f469e979a7b9ec875b5e7bdaa2ef6b85596ca31b45174f68cd7398b18","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"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","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-replication.html","sha256":"52bd5892f7e5511d05f46fc0c13a017de85307c674a9014948eb4ad480326c15"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"integer","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION","file":"runtime-config-replication.html","lang":"en","sha256":"c0b8bd86131ec62d4df97ce480d004aa7e3544477d053f0c2d4047b9edad5cc0","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\u003e\n        Maximum number of parallel apply workers per subscription. This\n        parameter controls the amount of parallelism for streaming of\n        in-progress transactions with subscription parameter\n        \u003ccode\u003estreaming = parallel\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The parallel apply workers are taken from the pool defined by\n        \u003ccode\u003emax_logical_replication_workers\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The default value is 2. This parameter can only be set in the\n        \u003ccode\u003epostgresql.conf\u003c/code\u003e file or on the server command\n        line.\n       \u003c/p\u003e","SourceRevision":"wiki-repair-20261023:d23549af9da950894a2095bb509b9b01ed448f441e6fd498bfa35d5894726cf2","ContentHash":"20d1b37ebeb1d6ba30eda4fb914cf62d50d1a686033d2ab41ab2c33f7ae685cc","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":"en","Fallback":false,"Versions":["16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
