Skip to content

Use fewer queries for CI charts

Ahmad Sherif requested to merge fix/use-fewer-queries-for-ci-charts into master

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?

#20262 (closed)

Screenshots (if relevant)

N/A

Does this MR meet the acceptance criteria?

Merge request reports

Loading