From 09076b0070dfa53d059db17abf48a385fcbf51c1 Mon Sep 17 00:00:00 2001
From: Heinrich Lee Yu <heinrich@gitlab.com>
Date: Wed, 17 Jan 2024 16:56:28 +0800
Subject: [PATCH] Improve performance of group work items query

Use a UNION instead of UNION ALL because it results in a much better
query plan.
---
 app/finders/issues_finder.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb
index b47e8a47a7fc0..8e7bc5d49c39d 100644
--- a/app/finders/issues_finder.rb
+++ b/app/finders/issues_finder.rb
@@ -118,7 +118,7 @@ def by_parent(items)
     namespaces = if relations.one?
                    relations.first
                  else
-                   Namespace.from_union(relations, remove_duplicates: false)
+                   Namespace.from_union(relations)
                  end
 
     items.in_namespaces(namespaces)
-- 
GitLab