Backend: Fix N+1 in previousStageJobsAndNeeds
Summary
An N+1 was discovered in previousStageJobsAndNeeds when the spec was updated for it by just adding one extra build that is part of an additional stage, which can be seen in this job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4868684404.
Proposal
Since this would happen with the addition of the new previousStageJobs field in #389195 (closed) and the N+1s are compounded if we have both fields in the query, the N+1 should be fixed before #389195 (closed) is implemented.
Additional details
Some relevant technical details, if applicable, such as:
- Does this need a feature flag?
- Does there need to be an associated instrumentation issue created related to this work?
- Is there an example response showing the data structure that should be returned (new endpoints only)?
- What permissions should be used?
- Is this EE or CE?
-
EE -
CE
-
- Additional comments:
Implementation Table
Links/References
Edited by Mark Nuzzo