diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-24 18:17:04 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-05 11:53:45 +0200 |
commit | 42062a454a650d81d9fe6dddde7b39b056ec0a88 (patch) | |
tree | 2c4be27afab763e04404ddd32b021a098a5cfc15 /app/finders | |
parent | 3d61421fb2ed22d64a6b20701d600a38db1458f5 (diff) | |
download | gitlab-ce-42062a454a650d81d9fe6dddde7b39b056ec0a88.tar.gz |
Re-use issue/MR counts for the pagination systemmr-index-page-performance
This changes the issue and MR index pages so the pagination system
re-uses the output of the COUNT(*) query used to calculate the number of
rows per state (opened, closed, etc). This removes the need for an
additional COUNT(*) on both pages.
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index c8dd2275730..9848497f258 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -61,6 +61,10 @@ class IssuableFinder execute.find_by(*params) end + def row_count + Gitlab::IssuablesCountForState.new(self).for_state_or_opened(params[:state]) + end + # We often get counts for each state by running a query per state, and # counting those results. This is typically slower than running one query # (even if that query is slower than any of the individual state queries) and |