Node.js · Middle · Question 47 of 75
What is the N+1 query problem?
- 1Running more than one database server
- 2A query that returns N+1 rows instead of N
- ✓Correct answer: Loading a list with one query, then running one more query per item, instead of one or two queries in total
Explanation
For 100 posts it means 101 queries. Fix it with a JOIN, WHERE id IN (...) or batching (e.g. DataLoader in GraphQL).