GraphQL: N+1 when loading issues inside an epic
The following discussion from !13248 (merged) should be addressed:
I'm interested in how we avoid N+1s here. If I ask for the issues for 30 different epics in a single graphql query, do I have one query for epics and one for issues, or one for epics then 30 for issues?
So we have two problems:
- N+1 SQL query
- We load all issues into memory
Look at using
BatchLoader to intelligently load all the issues for the requested epics, and without loading them all into memory.
We should implement #29102 (closed) first (or at the same time)
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28277#note_175756132 we made the same decision.
Namespace.projects needs this improvement