Performance

N+1 Problem

English

Overview

An inefficient state where a query that could be batched is instead issued repeatedly.

Details

An anti-pattern where fetching related data issues a query once per item instead of batching them, even though it could have been retrieved in one query. For example, fetching each post's author separately for every post in a list issues (number of posts) + 1 queries.

More Database terms