Performance
N+1: free-recall review
Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what makes the material stick.
Reconstruct the unit’s spine — why trip count drives cost, the four fix families and how to choose, DataLoader’s mechanism, off-CPU detection, and the second-order failures at scale — without looking back at the lessons.
- 01Why does fetching 100 rows in one query beat 100 single-row queries, even when each query is fast?
- 02Name the four N+1 fix families and the data shape each one fits.
- 03Explain how DataLoader works and why ORM eager loading cannot replace it for GraphQL.
- 04Why do CPU profiles miss N+1, and what three instruments surface it?
- 05How does N+1 cascade into connection-pool exhaustion, and what signals reveal it?
- 06When is denormalisation (counter cache, materialised view, CQRS read model) the right answer for N+1, and when is it premature?
If you could reconstruct each answer from memory, you hold the unit’s spine: trip count — not per-query speed — drives the cost; the four fix families map onto cardinality and lookup origin; DataLoader batches at request scope where ORM preload cannot reach; N+1 hides off-CPU and is found in query logs, APM waterfalls, and per-request counters, then gated in CI; and at scale it cascades into pool exhaustion, plan flips, and DoS, with denormalisation reserved for when measurement proves batching alone cannot meet the SLO.