From acca3042a2ca48acfc7a29fc0fec9d2880f217f1 Mon Sep 17 00:00:00 2001 From: yylian Date: Tue, 13 Aug 2024 13:53:46 +0200 Subject: [PATCH 1/2] fix: Remove duplicate database indices --- CHANGELOG.md | 2 ++ .../migration/V12__DROP_duplicate_indices.sql | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab2c06b5..48aef3d42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md). #### Patch Changes +- Remove duplicate database indices if they exist + ### Deployment Migration Notes #### Compatible Versions diff --git a/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql b/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql new file mode 100644 index 000000000..d5463880a --- /dev/null +++ b/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql @@ -0,0 +1,30 @@ +-- +-- Copyright (c) 2024 sovity GmbH +-- +-- This program and the accompanying materials are made available under the +-- terms of the Apache License, Version 2.0 which is available at +-- https://www.apache.org/licenses/LICENSE-2.0 +-- +-- SPDX-License-Identifier: Apache-2.0 +-- +-- Contributors: +-- sovity GmbH - Improve database performance by removing duplicate indices +-- + +-- Drop the non _pk index for edc_contract_agreement if it exists. +DROP INDEX IF EXISTS contract_agreement_id_uindex; + +-- Drop the non _pk index for edc_contract_negotiation if it exists. +DROP INDEX IF EXISTS contract_negotiation_id_uindex; + +-- Drop the non _pk index for edc_data_request if it exists. +DROP INDEX IF EXISTS data_request_id_uindex; + +-- Drop the non _pk index for edc_lease if it exists. +DROP INDEX IF EXISTS lease_lease_id_uindex; + +-- Drop the non _pk index for edc_policydefinitions if it exists. +DROP INDEX IF EXISTS edc_policydefinitions_id_uindex; + +-- Drop the non _pk index for edc_transfer_process if it exists. +DROP INDEX IF EXISTS transfer_process_id_uindex; From 91130749a6b294a8688b7b73ff213c2e96e7efd3 Mon Sep 17 00:00:00 2001 From: yylian Date: Tue, 13 Aug 2024 16:38:25 +0200 Subject: [PATCH 2/2] fix: Improve documentation --- CHANGELOG.md | 2 +- .../db/migration/V12__DROP_duplicate_indices.sql | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48aef3d42..09e0442c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md). #### Patch Changes -- Remove duplicate database indices if they exist +- Improve database performance by removing duplicate indexes ### Deployment Migration Notes diff --git a/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql b/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql index d5463880a..e1a8f3d46 100644 --- a/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql +++ b/extensions/postgres-flyway/src/main/resources/db/migration/V12__DROP_duplicate_indices.sql @@ -11,20 +11,11 @@ -- sovity GmbH - Improve database performance by removing duplicate indices -- --- Drop the non _pk index for edc_contract_agreement if it exists. +-- Drop the duplicate indexes if they exist for improved resource usage. DROP INDEX IF EXISTS contract_agreement_id_uindex; - --- Drop the non _pk index for edc_contract_negotiation if it exists. DROP INDEX IF EXISTS contract_negotiation_id_uindex; - --- Drop the non _pk index for edc_data_request if it exists. DROP INDEX IF EXISTS data_request_id_uindex; - --- Drop the non _pk index for edc_lease if it exists. DROP INDEX IF EXISTS lease_lease_id_uindex; - --- Drop the non _pk index for edc_policydefinitions if it exists. DROP INDEX IF EXISTS edc_policydefinitions_id_uindex; - --- Drop the non _pk index for edc_transfer_process if it exists. DROP INDEX IF EXISTS transfer_process_id_uindex; +