graphql-n-plus-one-remediation
Installation
SKILL.md
graphql-n-plus-one-remediation
What N+1 looks like in a resolver tree
One field returns a list of N rows. The executor then invokes the resolver
for each inner field once per row, so if Query.topReviews returns ten
reviews the executor resolves Review.product ten times, and a data-source
call in that child field becomes ten calls
(apollographql.com).
So 1 outer query plus N inner queries equals N+1.
// Parent resolver fetches N posts
posts: () => db.posts.findMany({ limit: 50 })