How we cut p95 board load time by 60%
One N+1 query, one missing index, and a vote count that had no business being computed on read.
A board with 400 items took 1.8s at p95. It now takes 700ms, and none of the work was clever.
The N+1. Every item fetched its own category row. One join removed 400 round trips.
The index. Sorting by votes scanned the whole table. (organization_id, status, vote_count desc) fixed the plan.
The counter. Vote totals were aggregated per request. They are denormalised onto the item now and reconciled on write.
Nothing here needed a cache.
- Engineering
- Performance