N+1 problem
Running 1 query to fetch a list and N more, one per item, when 1 or 2 were enough.
Example
Showing 100 orders with their user: 101 queries instead of 1 with a JOIN.
Test yourself: N+1 problem
SQL databases
With the N+1 problem, showing 100 orders with their user runs 101 queries.
1 query fetches the 100 orders and 100 more fetch each user: 1 + 100 = 101.
0/1
â–¶ Play