12 · Databases & SQL

N+1 Query

One query plus one per row

A performance smell: you fetch a list with one query, then run another query for each row. One hundred users become one hundred and one database round trips.

Concrete example

Loading posts, then querying the author for each post in a loop, is a classic N+1.

Why it matters

A common reason an agent-built page feels fine locally and dies under real data.