4 ms·
> Data fetching and the N+1 problem > [...] if a field resolver hits an external data source such as a DB or HTTP API, and > it is nested in a list cont
by eterps 2y ago
> Data fetching and the N+1 problem
> [...] if a field resolver hits an external data source such as a DB or HTTP API, and
> it is nested in a list containing N items, it will do those calls N times
Why is this considered a problem regardless of the situation at hand?
F.e. using REST, if the nested list contains on average N-2 items that can be efficiently cached, wouldn't that be better than having the cache constantly invalidated on the aggregation of the parent and its items?