[MR Analytics] Preload records for Throughput table

Problem to solve

On the MR Analytics page (which exists at the project level), the Throughput table loads rather slowly.

Proposal

  1. Research the worst queries (N+1).
  2. Try preloading them.

Further details

  • This proposal is based on @ahegyi's suggestion.
  • If preloading is not possible, the FE might need to do a separate query for the slow columns. This makes the initial rendering of the table fast.

Data to preload

done attribute how to preload
X user_notes_count, labels use GROUP BY COUNT
X merge_request_diffs probably we can use the metrics to get the line data?
X routes, namespaces we load a lot's of these records, probably for the URLS? Use the standard includes method. (Fixed by fixing labels.)
X approvals This was not a problem, there is no n+1.
pipelines this might be tricky, the query looks very complex (optional)
Edited by Dan Jensen