Skip to content

max_worker_processes

max_worker_processes — Maximum number of concurrent worker processes. Observed in PG9.4–19 Beta 3; its last measured boot default is 8 in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Maximum number of concurrent worker processes.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuepostmaster
Requires a server restart
Unit , Value
Raw unit
Range , Value0262143
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueResource Usage / Worker Processes
Upstream classification
Latest boot value , Value8
8

Lifecycle

Fact Value
First observed PG9.4
Present in PG9.4–19 Beta 3
Removed in No
Introduction commit 6bc8ef0b7f1f — Add new GUC, max_worker_processes, limiting number of bgworkers.
Commit date 2013-07-04
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.4–19 Beta 3 8 8

How it works

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.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
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.
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.
Small nodes 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.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP 24 different {{ pg_max_worker_processes + 8 }}
OLAP 28 different {{ pg_max_worker_processes + 8 }}
CRIT 24 different {{ pg_max_worker_processes + 8 }}
TINY 20 different {{ pg_max_worker_processes + 8 }}
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.4–19 Beta 3 = 24 (dcs); OLAP: PG9.4–19 Beta 3 = 28 (dcs); CRIT: PG9.4–19 Beta 3 = 24 (dcs); TINY: PG9.4–19 Beta 3 = 20 (dcs). Advice, pending human review — Editorial inference, pending maintainer review: The template expression adds worker headroom above its profile variable, likely reserving slots for extensions, replication, and parallel work; the exact capacity model needs maintainer confirmation.

Common 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.

max_parallel_workers · max_parallel_workers_per_gather · max_parallel_maintenance_workers · max_logical_replication_workers · max_wal_senders

References