Add preload option to MergeRequest#recent_commits to avoid N+1 queries
What does this MR do and why?
Part of a process to begin preloading merge request commit metadata to avoid possible N+1 queries. This will consist of 5 MRs total, described in the table below.
This MR will add preloading to MergeRequest#recent_commits when the caller will be getting information from an associated MergeRequestCommitMetadata record (to avoid an N+1).
| Order | MR/status | Description |
|---|---|---|
| Part 1 | !203465 (merged) | Adding scope to preload the latest diff commit |
| Part 2a |
!204107 (merged) | Add preloading to MergeRequest#recent_commits
|
| Part 2b | !204128 (merged) | Add preloading to MergeRequest#committers (relies on !204107 (merged)) |
| Part 3 | !204132 (merged) | Add preloading to MergeRequestDiff#commit_shas
|
| Part 4 | !204123 (merged) | Add Banzai find_commit_by_sha preloading |
References
https://gitlab.com/gitlab-org/gitlab/-/issues/527235
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Gary Holtz