InterviewBuddy
All interview questions

What causes the GraphQL N+1 query problem?

Advanced

Answer

Resolving a list and then fetching a related object separately for every item creates many backend requests. Batch compatible lookups and cache within a request.

Explanation

Keep caches appropriately scoped so one user's authorized data does not leak to another.

Example

One posts query plus 30 author queries becomes one posts query plus one batched authors query.