// postgresql · parallelism & workers

max_parallel_workers_per_gather

Workers a single Gather node may start; 0 disables parallel query.

Par défaut
2
Range
0 to 1024
Restart needed
Non
Default checked on
PostgreSQL 18

Ce que cela fait

The leader process also participates, so 2 workers means up to 3 processes on that plan node. Workers are only used when the planner estimates parallelism pays off (see parallel_setup_cost and min_parallel_table_scan_size).

Valeur par défaut

2. 2 (PostgreSQL 18).

Check the current value

SHOW max_parallel_workers_per_gather;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'max_parallel_workers_per_gather';

Change it

SET max_parallel_workers_per_gather = 4;   -- this session
ALTER ROLE reporting SET max_parallel_workers_per_gather = 4;   -- new sessions of one role

ALTER SYSTEM SET max_parallel_workers_per_gather = 4;
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 for analytics roles or reporting sessions on machines with idle cores; set to 0 for latency-sensitive OLTP roles if parallel plans cause jitter.

What can go wrong

Every worker gets its own work_mem per node, so memory use rises with parallelism.

The closest setting on other engines

MoteurParamètrePar défautRestart
PostgreSQL max_parallel_workers_per_gather this page 2 Non
SQL Server max degree of parallelism 0 Non
Oracle parallel_degree_policy MANUAL Non

Questions about max_parallel_workers_per_gather

What is the default value of max_parallel_workers_per_gather in PostgreSQL?

2. 2 (PostgreSQL 18).

Does changing max_parallel_workers_per_gather 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_per_gather?

Raise for analytics roles or reporting sessions on machines with idle cores; set to 0 for latency-sensitive OLTP roles if parallel plans cause jitter.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check max_parallel_workers_per_gather 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.