gitlab-org--gitlab-foss/lib/ci
Douwe Maan 7e04ee9af8 Merge branch 'fix/use-fewer-queries-for-ci-charts' into 'master'
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?
#20262 

## Screenshots (if relevant)
N/A

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- ~~[ ] API support added~~
- ~~Tests~~
  - ~~[ ] Added for this feature/bug~~
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5502
2016-08-01 19:57:27 +00:00
..
api Use AR callbacks as suggested by: 2016-06-29 17:44:39 +08:00
assets
ansi2html.rb Replace \n to <br> 2016-05-23 21:59:07 -05:00
charts.rb Use fewer queries for CI charts 2016-07-27 14:19:15 +02:00
gitlab_ci_yaml_processor.rb Move job dependencies entry to the new CI config 2016-07-20 14:15:18 +02:00
model.rb
static_model.rb
version_info.rb