Merge pull request #1097 from jakedt/snowflake

Improve performance by removing unnecessary group by fields
This commit is contained in:
Jake Moshenko 2015-12-22 11:38:38 -05:00
commit b0279a8992
2 changed files with 4 additions and 4 deletions

View file

@ -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())

View file

@ -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)