Cookbook recipe

Why parallel query did not kick in

Applies to PostgreSQL 13–17 Last reviewed May 2026 Grounded in source
Estimated investigation4 min

Scenario

A big aggregate runs single-threaded even though you have spare cores. Several settings and conditions gate parallelism. Diagnose it Check the gates and force a test: SHOW max_parallel_workers_per_gather; SHOW parallel_setup_cost; EXPLAIN SELECT count(*) FROM big_table; --…

Investigation Path

A big aggregate runs single-threaded even though you have spare cores. Several settings and conditions gate parallelism.

Diagnose it

Check the gates and force a test:

SHOW max_parallel_workers_per_gather;
SHOW parallel_setup_cost;
EXPLAIN SELECT count(*) FROM big_table;  -- look for 'Gather'

Why it happens

Parallelism is skipped when the table is small, max_parallel_workers_per_gather is 0, the plan cost is below parallel_setup_cost threshold, or the query uses parallel-unsafe functions/locks.

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • How to fix it
  • Prevent it next time
  • Related & next steps
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Career Impact

This scenario builds production judgment and operational confidence under pressure.

Open Career Dashboard →

Keep going

Related & next steps

Was this helpful?

← All cookbook recipes