One Screen Can Become a Thousand Statements Without a Line of SQL in Sight
The floor assumes the learner writes handlers in a framework, which is exactly where this pattern is invisible and universal, and it is the single commonest cause of a slow page in an application whose statements are all individually fine. It rests on rows-touched only lightly and on nothing else, so it can be taught early. It also motivates the guilty-statement node, because the aggregate-by-total-time view is the only measurement that ever surfaces it.
Questions this Concept answers
- Why does a database's own slow-statement reporting never fire on an N+1 page?
Finding and Fixing the N+1 Query from ORM Lazy Loading with selectinload in SQLAlchemy
The N+1 query problem is a performance failure mode of object-relational mappers in which one statement retrieves a collection of parent rows and one additional statement is issued per row to resolve…