n-plus-one
Installation
SKILL.md
N+1 Query Problem
When to use
- The user wants to decide between eager loading a relation (
with/fetch join), batching IDs into anIN (...), or a single JOIN to collapse N+1 queries. - The user sees a query-count profiler (Debugbar, Telescope, Clockwork) reporting hundreds of near-identical SELECTs on one request.
- The user loops over a collection of records and accesses a related model inside the loop, firing a separate query for each row.