Issue#closed_by_merge_requests can probably be optimized
The method Issue#closed_by_merge_requests
works as following:
- Grab all system notes
- For every system note extract the merge requests that it references, store these in A
- Remove all duplicate MRs from A, store this in B
- Reduce B down to MRs that are opened and close the current issue
The timings of this method can be found at dashboard http://performance.gitlab.net/dashboard/db/issue-closed_by_merge_requests, they look as following for the past 3 hours (for those that don't have access to the above URL):
Similar to gitlab-org/gitlab-ce#13651 this will probably require changing the Markdown pipeline to allow processing of multiple notes at once (and thus using only 1 query to get all merge requests) instead of processing them one by one.