Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Performance optimisation while getting the Data from DB for chart versions for a particular chart #2139

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,9 @@ func (impl AppStoreApplicationVersionRepositoryImpl) FindVersionsByAppStoreId(id
var appStoreApplicationVersions []*AppStoreApplicationVersion
err := impl.dbConnection.
Model(&appStoreApplicationVersions).
Column("app_store_application_version.*", "AppStore", "AppStore.ChartRepo").
Join("inner join app_store aps on aps.id = app_store_application_version.app_store_id").
Join("inner join chart_repo as cr on cr.id = aps.chart_repo_id").
Where("aps.id = ?", id).
Order("app_store_application_version.created DESC").
Column("app_store_application_version.id", "app_store_application_version.version").
Where("app_store_id = ?", id).
Order("created DESC").
Select()
return appStoreApplicationVersions, err
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/sql/66_app_store_application_version_index.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---- DROP index
DROP INDEX IF EXISTS public.app_store_application_version_app_store_id_IX;
2 changes: 2 additions & 0 deletions scripts/sql/66_app_store_application_version_index.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- Create index on app_store_id in app_store_application_version
CREATE INDEX IF NOT EXISTS app_store_application_version_app_store_id_IX ON public.app_store_application_version USING btree(app_store_id);