jargon

Design patterns·Objects and the database between them

you looped over a hundred orders reading customer.name, and the log showed a hundred and one queries.

Lazy loading

Also calledlazy load, deferred loading, lazy association

Deferring the loading of an associated object until it is first accessed, usually through a virtual proxy or a marker on the field. It makes a naive read cheap and makes the cost of a loop invisible, which is the entire mechanism behind the N+1 query problem. It also produces the other classic failure — touching a lazy field after the session has closed, which fails at a point far from the query that caused it.

Commonly confused with