Dashboard query plan regression
Your task
A dashboard query slowed from 200ms to 8s for some users but stayed fast for others, with no deploy. The query filters tasks by assignee_id and status. EXPLAIN ANALYZE on a slow case shows the planner estimating ~50 rows but actually returning ~900k, it chose an index nested loop that's terrible at that real volume. The status column is wildly skewed: 95% of all rows are status='done', and the slow users are ones querying their large pile of done tasks. Stats are up to date. Triage and mitigate.
It covers
- Cardinality estimation
- Or conditions
- Skewed distribution