max_worker_processes
Total background worker processes the server can run.
- По умолчанию
8- Range
- 0 to 262143
- Restart needed
- Да
- Default checked on
- PostgreSQL 18
Что оно делает
The pool that parallel query workers, logical replication workers and extension background workers all draw from. max_parallel_workers cannot exceed it in practice.
Значение по умолчанию
8. 8 (PostgreSQL 18).
Check the current value
SHOW max_worker_processes; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'max_worker_processes';
Change it
ALTER SYSTEM SET max_worker_processes = 16; -- applies only after a server restart
Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When to change it
On machines with more than 8 cores that run parallel queries, or when extensions (pg_cron, TimescaleDB) need background workers. Standbys must have at least the primary's value.
What can go wrong
Each worker is a process with its own memory; the setting itself only reserves slots.
Questions about max_worker_processes
What is the default value of max_worker_processes in PostgreSQL?
8. 8 (PostgreSQL 18).
Does changing max_worker_processes require a restart?
Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When should I change max_worker_processes?
On machines with more than 8 cores that run parallel queries, or when extensions (pg_cron, TimescaleDB) need background workers. Standbys must have at least the primary's value.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check max_worker_processes on your own server
SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.