Why doesn't PostgreSQL use a parallel execution plan?
In PostgreSQL 16, an analytical SELECT calculates aggregates over tens of millions of rows. The server has plenty of CPU cores, yet the query runs sequentially. In another scenario, the plan contains a Gather node, but fewer worker processes start than planned. How would you investigate each case? Explain what limits parallel execution in PostgreSQL, how parallel aggregation works, and what trade-offs come with increasing the number of workers.
ExplainEXPLAIN and optimizationSeniorData EngineerBackendAnalyst