0PricingLogin
PostgreSQL Performance & Query Optimization · Lesson

When the Planner Chooses Parallel Plans

Understand the cost thresholds and table sizes that trigger parallel scans and joins.

Parallelism Is a Cost Decision

PostgreSQL does not run every query in parallel. The planner only generates a parallel plan when it believes the extra cost of spinning up workers will be repaid by faster execution.

  • Workers cost money: the planner adds startup and tuple-transfer overhead for each one.
  • Parallelism only pays off when the table is large enough and the work is CPU- or IO-heavy enough.
  • Tiny tables and cheap queries stay sequential — the overhead would dominate.

In this lesson you will learn exactly which thresholds and table sizes flip the planner into a parallel plan.

The Three Gating GUCs

Three settings gate whether parallelism is even considered before any cost math runs:

  • max_parallel_workers_per_gather — max workers a single Gather node may request (default 2). If 0, parallelism is disabled for that query.
  • max_parallel_workers — cap across the whole instance (default 8).
  • max_worker_processes — the hard OS-level ceiling on background workers (default 8).

If max_parallel_workers_per_gather = 0, the planner never produces a parallel path, regardless of table size.

SHOW max_parallel_workers_per_gather;
SHOW max_parallel_workers;
SHOW max_worker_processes;

All lessons in this course

  1. When the Planner Chooses Parallel Plans
  2. Tuning Worker Counts and Gather Costs
  3. Parallel Aggregation and Hash Joins
  4. Diagnosing Why Parallelism Was Disabled
← Back to PostgreSQL Performance & Query Optimization