summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-04-06 12:24:33 +0200
committerAndreas Brandl <abrandl@gitlab.com>2018-04-09 18:49:08 +0200
commitcdfe437e8eaad61acf0ba7f2be719ef03d724493 (patch)
tree81d074e55760299e3f5516943b7145a9cb50d993
parent91a3a4b526214f4174f4f12de23dfb5baf033211 (diff)
downloadgitlab-ce-ab-37125-assigned-issues-query.tar.gz
Reduce complexity of issuable finder query.ab-37125-assigned-issues-query
This removes the extra check for project-ids which is not needed at all. This does not necessarily reduce execution time of the query, but improves planning time by a few millseconds. Closes #37125.
-rw-r--r--app/finders/issuable_finder.rb11
-rw-r--r--changelogs/unreleased/ab-37125-assigned-issues-query.yml5
2 files changed, 12 insertions, 4 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 61c72aa22a8..7ed9b1fc6d0 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -159,7 +159,10 @@ class IssuableFinder
finder_options = { include_subgroups: params[:include_subgroups], only_owned: true }
GroupProjectsFinder.new(group: group, current_user: current_user, options: finder_options).execute
else
- ProjectsFinder.new(current_user: current_user, project_ids_relation: item_project_ids(items)).execute
+ opts = { current_user: current_user }
+ opts[:project_ids_relation] = item_project_ids(items) if items
+
+ ProjectsFinder.new(opts).execute
end
@projects = projects.with_feature_available_for_user(klass, current_user).reorder(nil)
@@ -316,9 +319,9 @@ class IssuableFinder
def by_project(items)
items =
if project?
- items.of_projects(projects(items)).references_project
- elsif projects(items)
- items.merge(projects(items).reorder(nil)).join_project
+ items.of_projects(projects).references_project
+ elsif projects
+ items.merge(projects.reorder(nil)).join_project
else
items.none
end
diff --git a/changelogs/unreleased/ab-37125-assigned-issues-query.yml b/changelogs/unreleased/ab-37125-assigned-issues-query.yml
new file mode 100644
index 00000000000..5d4aad08764
--- /dev/null
+++ b/changelogs/unreleased/ab-37125-assigned-issues-query.yml
@@ -0,0 +1,5 @@
+---
+title: Reduce complexity of issuable finder query.
+merge_request: 18219
+author:
+type: performance