Use fewer queries for CI charts
What does this MR do?
It reduces number of queries sent for aggregating counts for CI graphs.
Are there points in the code the reviewer needs to double check?
N/A
Why was this MR needed?
For this project (gitlab-ce), loading /graphs/master/ci
is so slow it times out eventually. I did a quick benchmarking on production and found that it can take 72.5 seconds to only load the controller action variables (there are queries done from the view, didn't look into those). This MR reduces the time to about 2.5 seconds.
Extra improvement could be done by introducing an index on gl_project_id
and created_at
for ci_builds
table, but I can't confirm that right now.
What are the relevant issue numbers?
Screenshots (if relevant)
N/A
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added [ ] Documentation created/updated[ ] API support added-
Tests[ ] Added for this feature/bug-
All builds are passing
-
Conform by the style guides -
Branch has no merge conflicts with master
(if you do - rebase it please) -
Squashed related commits together