Parallel Query: Workers Planned 0 despite enabled configuration
0 reputation · 07 Nov 2021, 17:22 UTC
Parallel Query Planning Behavior
In PostgreSQL (version 10 through 16), the query planner determines whether to utilize parallel workers based on a cost-benefit analysis. Even when max_parallel_workers and max_parallel_workers_per_gather are configured to allow concurrency, the planner may still produce a serial plan if the estimated cost of the operation does not exceed the internal threshold defined by parallel_setup_cost and parallel_tuple_cost.
Configuration Constraints
The decision to spawn workers is not a binary toggle but a cost-based estimation. When EXPLAIN output indicates "Workers Planned: 0", it suggests the planner believes the overhead of coordinating parallel processes outweighs the execution time savings for that specific data volume and query structure.
What specific metrics or hidden cost thresholds trigger the transition from a serial plan to a parallel plan? How can the relationship between parallel_tuple_cost and the planner's decision be verified without guessing parameter values?