Allows the leader process to execute the query plan under Gather and Gather Merge nodes instead of waiting for worker processes.
At a glance
| Property | Value |
|---|---|
| Parameter | parallel_leader_participation |
| Category | Resource Consumption |
| Default | on |
| Value type | boolean (on/off) |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Allows the leader process to execute the query plan under Gather and Gather Merge nodes instead of waiting for worker processes. The default is on. Setting this value to off reduces the likelihood that workers will become blocked because the leader is not reading tuples fast enough, but requires the leader process to wait for worker processes to start up before the first tuples can be produced. The degree to which the leader can help or hinder performance depends on the plan type, number of workers and query duration.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW parallel_leader_participation; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'parallel_leader_participation';.
Tuning guidance
Leave it on so the leader also processes tuples; turn it off only when the leader is a bottleneck in Gather (expensive per-row work) and you want workers to do all the scanning.