max_parallel_workers
Maximum parallel query workers active at once across the server.
- 預設
8- Range
- 0 to 1024
- Restart needed
- 否
- Default checked on
- PostgreSQL 18
其作用
Caps parallel query and parallel maintenance workers together; limited in turn by max_worker_processes.
預設值
8. 8 (PostgreSQL 18).
Check the current value
SHOW max_parallel_workers; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'max_parallel_workers';
Change it
SET max_parallel_workers = 16; -- this session ALTER ROLE reporting SET max_parallel_workers = 16; -- new sessions of one role ALTER SYSTEM SET max_parallel_workers = 16; SELECT pg_reload_conf();
No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When to change it
Raise together with max_worker_processes on large machines, typically to the number of cores.
What can go wrong
Too high lets a few big queries take every core away from OLTP traffic.
Questions about max_parallel_workers
What is the default value of max_parallel_workers in PostgreSQL?
8. 8 (PostgreSQL 18).
Does changing max_parallel_workers require a restart?
No. No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When should I change max_parallel_workers?
Raise together with max_worker_processes on large machines, typically to the number of cores.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check max_parallel_workers 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.