summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-08-24 18:17:04 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-09-05 11:53:45 +0200
commit42062a454a650d81d9fe6dddde7b39b056ec0a88 (patch)
tree2c4be27afab763e04404ddd32b021a098a5cfc15 /app/finders
parent3d61421fb2ed22d64a6b20701d600a38db1458f5 (diff)
downloadgitlab-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.rb4
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