Investigate and fix incorrect N + 1 query specs in Merge request domain
MR: Pending
<!-- NOTE: For context on MR heading, see:
https://handbook.gitlab.com/handbook/engineering/devops/dev/create/remote-development/index.html#relationship-of-issues-to-mrs
-->
## Description
Spin off from: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/219362#note_3035659027
Also see: https://gitlab.com/gitlab-org/gitlab/-/work_items/592559#note_3149403804
While attempting to fix an observed performance regression in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/219362+, we identified N + 1 queries in global search merge request lookups. These N + 1 queries apparently always existed, but were skipped over in the specs due to setup differences ( the specs need Elasticsearch enabled on pipelines to pass, but this is not a default due to setup costs); a threshold was added to allow the specs to pass as is.
We also found out that some specs on the merge request API silently allowed N + 1 lookups to pass due to incorrect setup. These specs were rewritten, and a threshold was added to allow existing code to pass.
This issue aims to provide context to thresholds placed in the code, and as a reference point to either fix the N + 1 queries, or to link to specs where a threshold was needed due to the original setup to catch these queries not being correct
<!-- TODO: What kind of issue is this? Please uncomment and include one of the following:
/label ~"type::feature"
/label ~"type::bug"
/label ~"type::maintenance"
-->
## Acceptance criteria
## Implementation plan
<!-- NOTE: Feel free to expand with more sections and headers as needed -->
<!-- DO NOT TOUCH BELOW -->
issue