Skip to content
Discussion options

You must be logged in to vote

DataLoaders are designed to batch (database/backend) calls within a single request. This is required because a field datafetcher, which might need to load from an external datasource, will be invoked for each instance of its parent.
E.g. if I have a DataLoader for Product.price, and I load 500 products from a Query.products query, the Product.price datafetcher will be called 500 times. If Product.price would call out to a database, we would need to batch that.

Doing something similar for multiple requests adds many complications. Just to give some examples:

  1. How do we even know another request will come in that has similar needs
  2. It will negatively impact response times if requests have to…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gilteplitsky
Comment options

Answer selected by gilteplitsky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants