{"Entry":{"collection":"guc","key":"max_worker_processes","name":"max_worker_processes","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Worker Processes","category_zh":"","changed_in":["9.6","18"],"changes":[{"documentation_changed":false,"fields":{},"from":"9.3","status":"added","to":"9.4"},{"documentation_changed":true,"fields":{"max_val":{"from":"8388607","to":"262143"},"min_val":{"from":"1","to":"0"}},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"10","status":"changed","to":"11"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":false,"fields":{"category":{"from":"Resource Usage / Asynchronous Behavior","to":"Resource Usage / Worker Processes"}},"from":"17","status":"changed","to":"18"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"},{"documentation_changed":true,"fields":{},"from":"19","status":"changed","to":"20"}],"content_hash":"bb3023b7c2b9e130b52ff572eb95383e1facfcc888068995d2290f95a9272e37","context":"","default_changed_in":[],"default_history":[{"from":"9.4","to":"19","value":"8"}],"editorial":{"advice":{"olap":"Analytical work can use a larger max_worker_processes, but multiply per-node memory and I/O by concurrent statements. Benchmark throughput under realistic worker contention rather than one isolated query.","oltp":"Set max_worker_processes from a concurrency budget, not core count alone. Protect latency-sensitive OLTP from report and maintenance bursts, and verify actual Workers Planned versus Workers Launched.","small":"Keep max_worker_processes conservative on a small host. More possible workers can reduce throughput through context switching and memory pressure even when a single query becomes faster."},"mechanism":["max_worker_processes is the startup-time ceiling for concurrent background worker processes, including parallel workers and extension-managed workers. It is broader than max_parallel_workers.","The setting allocates shared control capacity but does not launch workers. Replication, extensions, logical apply, and parallel execution can all depend on slots beneath this ceiling.","A standby should normally configure the same or a higher value than its primary because worker requirements can be replayed or promoted. Increasing it without a CPU and memory budget only creates possible concurrency. Its postmaster context fixes the value at server start; changing it requires a restart."],"pitfalls":["Treating max_worker_processes as reserved capacity rather than an upper bound shared with other work.","Ignoring that parallel plans multiply CPU, I/O, and work_mem-limited nodes.","Benchmarking one query without concurrent worker contention.","Assuming planned workers will always be launched at execution time."],"references":[{"title":"PostgreSQL 19 Beta 4: max_worker_processes","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-MAX-WORKER-PROCESSES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["max_parallel_workers","max_parallel_workers_per_gather","max_parallel_maintenance_workers","max_logical_replication_workers","max_wal_senders"],"summary":"max_worker_processes — Maximum number of concurrent worker processes. Observed in PG9.4–19 Beta 4; its last measured boot default is 8 in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"9.4","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:31.766765+08:00","intro_commit":{"authored_at":"2013-07-04T11:24:24-04:00","discussion":[],"hash":"6bc8ef0b7f1f1df3998745a66e1790e27424aa0c","subject":"Add new GUC, max_worker_processes, limiting number of bgworkers.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=6bc8ef0b7f1f1df3998745a66e1790e27424aa0c"},"key":"max_worker_processes","last_version":"20","max_val":"","min_val":"","name":"max_worker_processes","position":290,"present_in":["9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Sets the maximum number of background processes that the cluster can support.","short_desc_zh":"","source_rev":"english-manuals:6d8e542625e874269e324d05a10339242e1131ab1c82a0a94060b2383e2e826a","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"max_worker_processes","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"max_worker_processes","SourceRevision":"english-manuals:6d8e542625e874269e324d05a10339242e1131ab1c82a0a94060b2383e2e826a","Facts":{"boot_val":"8","category":"Resource Usage / Worker Processes","context":"postmaster","description":"Sets the maximum number of background processes that the cluster can support. This parameter can only be set at server start. The default is 8. When running a standby server, you must set this parameter to the same or higher value than on the primary server. Otherwise, queries will not be allowed in the standby server. When changing this value, consider also adjusting max_parallel_workers, max_parallel_maintenance_workers, and max_parallel_workers_per_gather.","doc":{"anchor":"GUC-MAX-WORKER-PROCESSES","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"262143","metadata_version":"18","min_val":"0","name":"max_worker_processes","short_desc":"Maximum number of concurrent worker processes.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-WORKER-PROCESSES","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"max_worker_processes","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"max_worker_processes","Summary":"","BodyHTML":"\u003cp\u003e设置集簇能够支持的后台进程的最大数量。此参数只能在服务器启动时设置。默认值为 8。\u003c/p\u003e\u003cp\u003e运行备库时，必须将此参数设为与主库相同或更大的值。否则，备库上将不允许执行查询。\u003c/p\u003e\u003cp\u003e更改此值时，也应考虑调整\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-WORKERS\" rel=\"nofollow\"\u003emax_parallel_workers\u003c/a\u003e、​\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-MAINTENANCE-WORKERS\" rel=\"nofollow\"\u003emax_parallel_maintenance_workers\u003c/a\u003e、​\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-WORKERS-PER-GATHER\" rel=\"nofollow\"\u003emax_parallel_workers_per_gather\u003c/a\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"91dd44d254c5c080df61c7b32fa386cfb1f920f39bbcc90889f7aa5ac9e34aeb","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置集簇能够支持的后台进程的最大数量。此参数只能在服务器启动时设置。默认值为 8。\u003c/p\u003e\u003cp\u003e运行备库时，必须将此参数设为与主库相同或更大的值。否则，备库上将不允许执行查询。\u003c/p\u003e\u003cp\u003e更改此值时，也应考虑调整\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-WORKERS\"\u003emax_parallel_workers\u003c/a\u003e、​\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-MAINTENANCE-WORKERS\"\u003emax_parallel_maintenance_workers\u003c/a\u003e、​\u003ca href=\"/docs/18/runtime-config-resource.html#GUC-MAX-PARALLEL-WORKERS-PER-GATHER\"\u003emax_parallel_workers_per_gather\u003c/a\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
