From ef4ff3567ea28c097df73ef5cf688412a8de51cd Mon Sep 17 00:00:00 2001 From: sekharpanja Date: Thu, 24 Aug 2023 21:20:37 +0100 Subject: [PATCH 1/3] adding state as index to ApplicationInstace model to improve performance --- dataworkspace/dataworkspace/apps/applications/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dataworkspace/dataworkspace/apps/applications/models.py b/dataworkspace/dataworkspace/apps/applications/models.py index 9234df6f75..7a61dff1f0 100644 --- a/dataworkspace/dataworkspace/apps/applications/models.py +++ b/dataworkspace/dataworkspace/apps/applications/models.py @@ -262,6 +262,7 @@ class Meta: models.Index(fields=["created_date"]), models.Index(fields=["owner", "created_date"]), models.Index(fields=["public_host", "state"]), + models.Index(fields=["state"]), ] permissions = [ ("start_all_applications", "Can start all applications"), From 1f09e2805a6ce5ffa7c5f5d600f8e2e292e06baa Mon Sep 17 00:00:00 2001 From: sekharpanja Date: Thu, 24 Aug 2023 21:26:15 +0100 Subject: [PATCH 2/3] adding migration --- ...tioninstance_app_applica_state_9beedf_idx.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py diff --git a/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py b/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py new file mode 100644 index 0000000000..b9e18daf0f --- /dev/null +++ b/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.20 on 2023-08-24 20:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('applications', '0022_auto_20230531_1549'), + ] + + operations = [ + migrations.AddIndex( + model_name='applicationinstance', + index=models.Index(fields=['state'], name='app_applica_state_9beedf_idx'), + ), + ] From 43dbd33f5f6b907b5b172143dea63e31574074d8 Mon Sep 17 00:00:00 2001 From: sekharpanja Date: Thu, 24 Aug 2023 21:27:59 +0100 Subject: [PATCH 3/3] fixup! adding migration --- ...023_applicationinstance_app_applica_state_9beedf_idx.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py b/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py index b9e18daf0f..3737c5cbae 100644 --- a/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py +++ b/dataworkspace/dataworkspace/apps/applications/migrations/0023_applicationinstance_app_applica_state_9beedf_idx.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('applications', '0022_auto_20230531_1549'), + ("applications", "0022_auto_20230531_1549"), ] operations = [ migrations.AddIndex( - model_name='applicationinstance', - index=models.Index(fields=['state'], name='app_applica_state_9beedf_idx'), + model_name="applicationinstance", + index=models.Index(fields=["state"], name="app_applica_state_9beedf_idx"), ), ]