System Design · Middle · Question 6 of 75

What is the N+1 problem in GraphQL and how is it solved?

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.

Further reading

Problem with a question

System Design · Middle · question 6

Test yourself

Take the System Design · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz