3 ms·
One nice thing about GraphQL though is that you have the context of the whole query available in resolvers, parsed into a tree (like an AST) for you. You're rig
by exogen 6y ago
One nice thing about GraphQL though is that you have the context of the whole query available in resolvers, parsed into a tree (like an AST) for you. You're right that the most obvious/default approach would lead one down the path of making an N+1 query in this scenario, but it's really up to the GraphQL resolvers to decide how to approach it.
In some projects of mine I've taken advantage of this extra available context to make the most efficient bulk database query or REST API call based on the full query, instead of just the subset of input typically used by the resolver.