Each checked field maps to a GraphQL resolver. The graph on the right is the schema: User → Posts → Comments → Author. Ticking a field grows the query tree; running it walks the tree level by level, lighting up each resolver as it executes.
- N+1 problem: without batching, resolving
author for every comment of every post fires one DB call per parent — 5 posts × 3 comments = 15 separate author lookups.
- DataLoader batching: collects all lookups requested in the same tick and merges them into a single batched DB call per level, cutting query count and round-trip time.
User {
posts {
comments {
author { name }
}
}
}