Common backend failure patterns · core
Slow queries, missing indexes and N+1 after a release
When only p99 gets worse after a release, a small share of requests is slow: often a new query with no index, or an ORM that runs one query per row (N+1). You find it with traces, the slow-query view and EXPLAIN.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- p50 flat and p99 up means a subset of requests is slow, or requests queue behind a shared resource. Averages hide this; always read percentiles per endpoint.
- Check order: latency per endpoint and per instance, traces of slow requests (which span grew), the database slow-query view (pg_stat_statements, the MySQL slow log), the plan (EXPLAIN ANALYZE), then runtime: GC pauses, pool wait time, CPU throttling.
- A query with no supporting index scans the table. Fix with a composite index; in Postgres build it with CREATE INDEX CONCURRENTLY so writes are not blocked.
- N+1: the ORM loads a list, then runs one more query for each row. Fix with one join, a batch load (WHERE id IN (...)) or eager loading.
- A slow tail at high traffic soon fills thread and connection pools and turns into errors, so waiting is risky. Roll back or flag the new path off first.
- A rollback does not stop a backfill started by the release. It uses disk IO and causes replica lag; pause it.
- Before a sale, test the new feature at 3x traffic. If it must ship, flag it off for the heavy users or cache the block.
- Prevent: a load test with production-sized data, query plans checked in review for new queries, and a per-endpoint p99 alert tied to each release.
The red pen
Common traps: mistake → fix
Mistake: The average latency is fine, so users are fine
Fix: p99 users are the unhappy ones; look at percentiles.
Mistake: Adding an index is always safe
Fix: a normal CREATE INDEX can block writes on a big table; use the concurrent form and watch IO.
Mistake: It is fast on my laptop with 1,000 rows
Fix: plans change with data size; test with production-sized data.
Easy to hard
Questions interviewers ask, easy to hard
- After a deploy, p99 went from 300 ms to 4 s but p50 did not change. What do you check?
- How do you find an N+1 problem?
- The rollback only helped halfway. What else could be running?
- How do you add an index to a very busy table safely?
- How would you have caught this before release?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.