Card 06/ 06

RecapDifficulty: Advanced1 min

What This Topic Established

The N+1 query pattern turns one list fetch into N+1 round trips through lazily loaded data — verified against real Hibernate statistics: twenty rows, twenty-one queries. At 20ms each, thirty such queries put a 600ms floor under a response, before anything else runs.

An external call needs a timeout, and ideally a circuit breaker, or a slow dependency makes your own endpoint exactly as slow with no limit. Above all: measure before optimizing — a query log or existing metrics turn "it feels slow" into a specific, fixable cause, which guessing never does.