Reduce N+1 queries from Projects::MergeRequestsController#index action related to protected branches and code owners
After resolving #276944 (closed), there are still N+1 queries like this when viewing https://gitlab.com/gitlab-org/gitlab/-/merge_requests:
SELECT "protected_branches".* FROM "protected_branches" WHERE "protected_branches"."project_id" = 278964 AND "protected_branches"."code_owner_approval_required" = TRUE
This can be seen from pb
when viewing the specified page. The goal of this issue is to reduce the number of queries executed to further improve the action.
Edited by Patrick Bajao