Indexes for queries that happen often

This commit is contained in:
Timo Bejan 2024-11-05 14:27:19 +02:00
parent be4e3c8633
commit 5ac68bf69d
2 changed files with 222 additions and 0 deletions

View File

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

View File

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