select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / RESOURCE USAGE

max_worker_processes

Read PG 18 manual ↗

Sets the maximum number of background processes that the cluster can support.

Type
integer
Context
postmaster
Measured default
8
Unit
Metadata snapshot
18

Definition PG 18 manual

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.

Measured default history
Version intervalDefault
9.4 – 198
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

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.

Operational considerations

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.

Workload guidance

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.

Version history 9
  1. PG 19 → 20changed
  2. PG 18 → 19changed
  3. PG 17 → 18changed
  4. PG 16 → 17changed
  5. PG 13 → 14changed
  6. PG 10 → 11changed
  7. PG 9.6 → 10changed
  8. PG 9.5 → 9.6changed
  9. PG 9.3 → 9.4added

Related entries

Further reading

Definition snapshot: english-manuals:bee25fd3e9b495c277b6fdcdca0… · English manual source