Courses / Node.js
46. Batching & DataLoader pattern
Use batching techniques or DataLoader to avoid N+1 fetch problems in resolvers.
1 min read Chapter 46 of 48
JavaScript
Batching & DataLoader pattern
A way to group many small data fetches into a few batched requests to avoid making N separate calls per request.
"I keep calling the database hundreds of times for fields I could get in three queries."
Batching gathers multiple requested IDs/keys and issues one combined fetch; DataLoader is a helper that caches and groups requests per tick to prevent N+1 queries.
"I keep calling the database hundreds of times for fields I could get in three queries."
Batching gathers multiple requested IDs/keys and issues one combined fetch; DataLoader is a helper that caches and groups requests per tick to prevent N+1 queries.