When the Postgres query planner goes rogue
Jul 13, 2026Nick Van Wiggeren

Summary
This post details an incident where the PostgreSQL query planner caused a sudden and severe CPU spike, leading to query failures. It explains how the planner's cost estimation can go awry, causing queries to abandon index usage and resort to full table scans. The post demonstrates how PlanetScale's Database Traffic Control feature was used to immediately block the problematic query pattern, restoring database health and providing a window to investigate and fix the underlying issue.