Remove order by clause to improve query performance

parent 2963bc01
...@@ -5,7 +5,6 @@ module Geo ...@@ -5,7 +5,6 @@ module Geo
.with_route .with_route
.joins(:repository_state) .joins(:repository_state)
.where(repository_outdated.or(wiki_outdated)) .where(repository_outdated.or(wiki_outdated))
.order(last_repository_updated_at_asc)
.limit(batch_size) .limit(batch_size)
end end
...@@ -14,7 +13,6 @@ module Geo ...@@ -14,7 +13,6 @@ module Geo
.with_route .with_route
.joins(left_join_repository_state) .joins(left_join_repository_state)
.where(repository_never_verified) .where(repository_never_verified)
.order(last_repository_updated_at_asc)
.limit(batch_size) .limit(batch_size)
end end
...@@ -64,9 +62,5 @@ module Geo ...@@ -64,9 +62,5 @@ module Geo
def repository_never_verified def repository_never_verified
repository_state_table[:project_id].eq(nil) repository_state_table[:project_id].eq(nil)
end end
def last_repository_updated_at_asc
Gitlab::Database.nulls_last_order('projects.last_repository_updated_at', 'ASC')
end
end end
end end
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