Slow COUNT(*) queries for Merge Requests in Milestones list
The milestones list page: https://gitlab.com/groups/gitlab-org/-/milestones is currently quite slow, resulting from an individual issue and merge request count being run for each milestone displayed. From a brief investigation it appears that the issue counts are cached, however the merge request counts are not, each of which can take over 500ms.
These counts use merge_requests_visible_to_user
so they also require checks against project_authorizations.
We should determine if we can effectively cache these counts and if so, we should do that. Alternative options include removing the MR counts from the milestone list, or reducing the complexity of the count by showing the total number of merge requests regardless of authorization, as it is only a count and no other information about the merge requests is included.