System Design · Middle · Question 6 of 75
What is the N+1 problem in GraphQL and how is it solved?
- ✓Correct answer: A DB query per item; solved with batching
- 2The client sends N+1 identical requests because of re-renders
- 3The schema has more types than there are tables in the database
Explanation
A list of 100 posts with an author field on each produces 1 + 100 queries. DataLoader collects ids within a single tick and makes one WHERE id IN (...) query, caching results for the duration of the request.