Code Room
On-callMediumoc-g426
Subject Slow queryLevel Mid–Senior~30 minCommon in Databases & SQL interviewsIndustries Technology

Question

After a feature launch that added an 'activity feed' to user dashboards, your DB's read load tripled and dashboard load times went from 300ms to 4s, worst for power users. APM shows the dashboard endpoint issuing 300+ near-identical small queries per request — one `SELECT ... WHERE id = ?` per feed item — each individually fast (under 1ms) but adding up. The feed query that fetches the item ids is itself quick. CPU is high but not pinned; connection count is elevated. Triage and mitigate.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

Diagram & narrate the incident
Loading whiteboard…
Run or narrate your approach, then ask the coach.