Node.js · Senior · Question 63 of 75
How does DataLoader solve the N+1 problem in a GraphQL server?
- ✓Correct answer: It collects all
load(id)calls made in one tick and turns them into one batched query, caching results per request - 2It caches all queries forever in Redis
- 3It disables nested fields
Explanation
Create a new DataLoader per request, so caching never mixes data between users.