diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-11-21 19:32:12 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-11-21 19:40:29 +0300 |
commit | 54f1e406f40a31c6d790bdeabc55556a268990e1 (patch) | |
tree | 50ce60e6931cc2da6a96bfa712bf699b1273b030 /changelogs | |
parent | 9024875e1f81a3aab3c0879d33a4cea912ce833d (diff) |
Use arrays in Pipeline#latest_builds_with_artifacts
This changes Ci::Pipeline#latest_builds_with_artifacts so it returns an
Array instead of a relation. Whenever we use this data we do so in two
steps:
1. Count the number of rows
2. If this number is greater than 0, iterate over the rows
By returning an Array instead we only execute 1 query of which the total
time/work is less than running either just a COUNT(*) or both queries
(in the worst case).
On GitLab.com this change should save us a few milliseconds per request
to ProjectsController#show.
Diffstat (limited to 'changelogs')
-rw-r--r-- | changelogs/unreleased/reduce-queries-for-artifacts-button.yml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/unreleased/reduce-queries-for-artifacts-button.yml b/changelogs/unreleased/reduce-queries-for-artifacts-button.yml new file mode 100644 index 00000000000..f2d469b5a80 --- /dev/null +++ b/changelogs/unreleased/reduce-queries-for-artifacts-button.yml @@ -0,0 +1,5 @@ +--- +title: Use arrays in Pipeline#latest_builds_with_artifacts +merge_request: +author: +type: performance |