Commit 0b408bec authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by Jan Provaznik

Remove CTE ordering in shared runners query

We don't need a specific order when looking for the root ancestors
parent 77dd6c63
......@@ -75,7 +75,7 @@ module EE
# rubocop: disable CodeReuse/ActiveRecord
def all_namespaces
namespaces = ::Namespace.reorder(nil).where('namespaces.id = projects.namespace_id')
::Gitlab::ObjectHierarchy.new(namespaces).roots
::Gitlab::ObjectHierarchy.new(namespaces, options: { skip_ordering: true }).roots
end
# rubocop: enable CodeReuse/ActiveRecord
......
---
title: Skip ordering when using distinct in shared runners CTE query
merge_request: 57312
author:
type: performance
......@@ -191,7 +191,7 @@ module Gitlab
def skip_ordering?
return options[:skip_ordering] if options.key?(:skip_ordering)
true
false
end
# Remove the extra `depth` field using an INNER JOIN to avoid breaking UNION queries
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment