From 9c1a2e7e1ba3daa33ea70a5d11f7aba03c2e495a Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Tue, 22 Dec 2015 11:35:49 -0500 Subject: [PATCH] Improve performance by removing unnecessary group by fields --- data/model/repository.py | 4 ++-- data/model/storage.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/model/repository.py b/data/model/repository.py index b613cd152..f39aacaf9 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -294,10 +294,10 @@ def get_sorted_matching_repositories(prefix, only_public, checker, limit=10): query = (Repository .select(*select_items) - .join(Namespace, JOIN_LEFT_OUTER, on=(Namespace.id == Repository.namespace_user)) + .join(Namespace, on=(Namespace.id == Repository.namespace_user)) .switch(Repository) .where(search_clause) - .group_by(Repository, Namespace)) + .group_by(Repository.id, Namespace.id)) if only_public: query = query.where(Repository.visibility == _basequery.get_public_repo_visibility()) diff --git a/data/model/storage.py b/data/model/storage.py index 5f1cc572d..ea626ef6d 100644 --- a/data/model/storage.py +++ b/data/model/storage.py @@ -48,8 +48,8 @@ def garbage_collect_storage(storage_id_whitelist): .switch(ImageStoragePlacement) .join(ImageStorage), storage_id_whitelist, - (ImageStorage, ImageStoragePlacement, - ImageStorageLocation))) + (ImageStorage.id, ImageStoragePlacement.id, + ImageStorageLocation.id))) paths_to_remove = placements_query_to_paths_set(placements_to_remove)