Skip to content

Reduce number of queries made for merge_requests/:id/diffs

Ahmad Sherif requested to merge fix/use-fewer-queries-for-mr-notes into master

What does this MR do?

It reduces the number of DB queries made while processing and rendering MR notes.

Are there points in the code the reviewer needs to double check?

N/A

Why was this MR needed?

For https://staging.gitlab.com/gitlab-org/gitlab-ce/merge_requests/3142/diffs.json, for each note we make number of DB queries, almost all of them are handled by the AR caching layer, but they seem to add up a few seconds. Testing on staging, calling merge_requests/3142/diffs.json was reduced to ~5.5 seconds from ~8 seconds.

What are the relevant issue numbers?

N/A

Screenshots (if relevant)

N/A

Does this MR meet the acceptance criteria?

Merge request reports

Loading