diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/db.changelog-tenant.yaml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/db.changelog-tenant.yaml index 82db9efe7..ae1a60634 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/db.changelog-tenant.yaml +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/db.changelog-tenant.yaml @@ -241,3 +241,5 @@ databaseChangeLog: file: db/changelog/tenant/148-add-quotechar-to-component-mapping.yaml - include: file: db/changelog/tenant/149-remove-based-on-dict-annotation-id-columns.yaml + - include: + file: db/changelog/tenant/149-add-indexes-across-tables-for-performance.yaml diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/tenant/149-add-indexes-across-tables-for-performance.yaml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/tenant/149-add-indexes-across-tables-for-performance.yaml new file mode 100644 index 000000000..40f8645d2 --- /dev/null +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/db/changelog/tenant/149-add-indexes-across-tables-for-performance.yaml @@ -0,0 +1,220 @@ +databaseChangeLog: + - changeSet: + id: create_index_if_not_exists_idx_file_last_updated + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_file_last_updated + tableName: file + changes: + - createIndex: + tableName: file + indexName: idx_file_last_updated + columns: + - column: + name: last_updated + + - changeSet: + id: create_index_if_not_exists_idx_file_deleted_hard_deleted_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_file_deleted_hard_deleted_time + tableName: file + changes: + - createIndex: + tableName: file + indexName: idx_file_deleted_hard_deleted_time + columns: + - column: + name: deleted + - column: + name: hard_deleted_time + + - changeSet: + id: create_index_if_not_exists_idx_file_dossier_id_deleted_hard_deleted_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_file_dossier_id_deleted_hard_deleted_time + tableName: file + changes: + - createIndex: + tableName: file + indexName: idx_file_dossier_id_deleted_hard_deleted_time + columns: + - column: + name: dossier_id + - column: + name: deleted + - column: + name: hard_deleted_time + + - changeSet: + id: create_index_if_not_exists_idx_dossier_last_updated + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_dossier_last_updated + tableName: dossier + changes: + - createIndex: + tableName: dossier + indexName: idx_dossier_last_updated + columns: + - column: + name: last_updated + + - changeSet: + id: create_index_if_not_exists_idx_dossier_soft_deleted_time_hard_deleted_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_dossier_soft_deleted_time_hard_deleted_time + tableName: dossier + changes: + - createIndex: + tableName: dossier + indexName: idx_dossier_soft_deleted_time_hard_deleted_time + columns: + - column: + name: soft_deleted_time + - column: + name: hard_deleted_time + + - changeSet: + id: create_index_if_not_exists_idx_dossier_id_soft_deleted_time_hard_deleted_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_dossier_id_soft_deleted_time_hard_deleted_time + tableName: dossier + changes: + - createIndex: + tableName: dossier + indexName: idx_dossier_id_soft_deleted_time_hard_deleted_time + columns: + - column: + name: id + - column: + name: soft_deleted_time + - column: + name: hard_deleted_time + + - changeSet: + id: create_index_if_not_exists_idx_dossier_soft_deleted_time_hard_deleted_time_archived_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_dossier_soft_deleted_time_hard_deleted_time_archived_time + tableName: dossier + changes: + - createIndex: + tableName: dossier + indexName: idx_dossier_soft_deleted_time_hard_deleted_time_archived_time + columns: + - column: + name: soft_deleted_time + - column: + name: hard_deleted_time + - column: + name: archived_time + + - changeSet: + id: create_index_if_not_exists_idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_time_archived_time + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_time_archived_time + tableName: dossier + changes: + - createIndex: + tableName: dossier + indexName: idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_time_archived_time + columns: + - column: + name: dossier_template_id + - column: + name: soft_deleted_time + - column: + name: hard_deleted_time + - column: + name: archived_time + + - changeSet: + id: create_index_if_not_exists_idx_notification_preference_user_id_in_app_notifications_enabled + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_notification_preference_user_id_in_app_notifications_enabled + tableName: notification_preference + changes: + - createIndex: + tableName: notification_preference + indexName: idx_notification_preference_user_id_in_app_notifications_enabled + columns: + - column: + name: user_id + - column: + name: in_app_notifications_enabled + + - changeSet: + id: create_index_if_not_exists_idx_notification_user_id_creation_date_soft_deleted + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_notification_user_id_creation_date_soft_deleted + tableName: notification + changes: + - createIndex: + tableName: notification + indexName: idx_notification_user_id_creation_date_soft_deleted + columns: + - column: + name: user_id + - column: + name: creation_date + - column: + name: soft_deleted + + - changeSet: + id: create_index_if_not_exists_idx_entity_dossier_template_id + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_entity_dossier_template_id + tableName: entity + changes: + - createIndex: + tableName: entity + indexName: idx_entity_dossier_template_id + columns: + - column: + name: dossier_template_id + + - changeSet: + id: create_index_if_not_exists_idx_entity_dossier_id + author: Timo + preConditions: + - not: + indexExists: + indexName: idx_entity_dossier_id + tableName: entity + changes: + - createIndex: + tableName: entity + indexName: idx_entity_dossier_id + columns: + - column: + name: dossier_id