Improve performance by removing unnecessary group by fields
This commit is contained in:
parent
5ac7369bf5
commit
9c1a2e7e1b
2 changed files with 4 additions and 4 deletions
|
@ -294,10 +294,10 @@ def get_sorted_matching_repositories(prefix, only_public, checker, limit=10):
|
||||||
|
|
||||||
query = (Repository
|
query = (Repository
|
||||||
.select(*select_items)
|
.select(*select_items)
|
||||||
.join(Namespace, JOIN_LEFT_OUTER, on=(Namespace.id == Repository.namespace_user))
|
.join(Namespace, on=(Namespace.id == Repository.namespace_user))
|
||||||
.switch(Repository)
|
.switch(Repository)
|
||||||
.where(search_clause)
|
.where(search_clause)
|
||||||
.group_by(Repository, Namespace))
|
.group_by(Repository.id, Namespace.id))
|
||||||
|
|
||||||
if only_public:
|
if only_public:
|
||||||
query = query.where(Repository.visibility == _basequery.get_public_repo_visibility())
|
query = query.where(Repository.visibility == _basequery.get_public_repo_visibility())
|
||||||
|
|
|
@ -48,8 +48,8 @@ def garbage_collect_storage(storage_id_whitelist):
|
||||||
.switch(ImageStoragePlacement)
|
.switch(ImageStoragePlacement)
|
||||||
.join(ImageStorage),
|
.join(ImageStorage),
|
||||||
storage_id_whitelist,
|
storage_id_whitelist,
|
||||||
(ImageStorage, ImageStoragePlacement,
|
(ImageStorage.id, ImageStoragePlacement.id,
|
||||||
ImageStorageLocation)))
|
ImageStorageLocation.id)))
|
||||||
|
|
||||||
paths_to_remove = placements_query_to_paths_set(placements_to_remove)
|
paths_to_remove = placements_query_to_paths_set(placements_to_remove)
|
||||||
|
|
||||||
|
|
Reference in a new issue