Card 02/ 06

ExampleDifficulty: Intermediate1 min

What N+1 Costs in Milliseconds

A single query taking 20 milliseconds is nothing to notice. Thirty of them, one per row in a list endpoint, is a different number entirely — and it's paid before anything else in the request has even started.

The floor an N+1 pattern puts under a response
QueriesEachBefore any other processing
3020ms600ms

That 600ms is a floor, not a total — serialising the response, running any business logic, and the network round trip to the client all still come after it. A list endpoint that feels sluggish "for no reason" very often has exactly this shape underneath: not one slow thing, but thirty fast things that were never meant to run one at a time.