# N Plus One Query

Record: `arch:n-plus-one-query`
Kind: anti-pattern
Layer: [Enforcement Core](https://banes-lab.com/records/layer/enforcement-core.md)
Severity: discouraged
Scope: architecture_evolution
Canonical: https://banes-lab.com/ontology#arch-n-plus-one-query

## Repair

- Refactored by: batch_fetch, join_or_include, preload, cache_projection
- Detected by: query_inside_loop, remote_call_inside_loop, query_count_scales_with_rows
- Violated by: Fetch a collection, then issue one query or remote call per item rather than fetching required related data intentionally.

## referenced-by

- [Algorithmic Efficiency](https://banes-lab.com/records/arch/algorithmic-efficiency.md)
