From 1b09deafc43f5d99a022e628333d03a37741c570 Mon Sep 17 00:00:00 2001 From: nscuro Date: Fri, 2 Feb 2024 14:54:38 +0100 Subject: [PATCH 1/2] Create GIN index on `"COMPONENT"."DIRECT_DEPENDENCIES"` to support dependency graph traversal Traversal is performed using recursive CTEs, with conditions such as: ``` WHERE "DIRECT_DEPENDENCIES" LIKE ('%' || :componentUuid || '%') ``` `"DIRECT_DEPENDENCIES"` is a JSON array containing zero or more JSON objects. Because `LIKE` is used with wildcards in before and after the UUID, a `BTREE` index cannot be used. Signed-off-by: nscuro --- .../resources/migration/changelog-v5.3.0.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/resources/migration/changelog-v5.3.0.xml b/src/main/resources/migration/changelog-v5.3.0.xml index 3d7ecc60b..b2e1fb912 100644 --- a/src/main/resources/migration/changelog-v5.3.0.xml +++ b/src/main/resources/migration/changelog-v5.3.0.xml @@ -2444,4 +2444,23 @@ + + + + CREATE EXTENSION IF NOT EXISTS PG_TRGM; + + + + + + + CREATE INDEX CONCURRENTLY IF NOT EXISTS "COMPONENT_DIRECT_DEPENDENCIES_GIN_IDX" + ON "COMPONENT" USING GIN ("DIRECT_DEPENDENCIES" GIN_TRGM_OPS); + + From c30d81cfb07d8b813809b0345a7c350c9039179a Mon Sep 17 00:00:00 2001 From: nscuro Date: Wed, 7 Feb 2024 13:36:25 +0100 Subject: [PATCH 2/2] Add clarification on `CREATE EXTENSION` changeset Signed-off-by: nscuro --- src/main/resources/migration/changelog-v5.3.0.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/resources/migration/changelog-v5.3.0.xml b/src/main/resources/migration/changelog-v5.3.0.xml index b2e1fb912..322f733a7 100644 --- a/src/main/resources/migration/changelog-v5.3.0.xml +++ b/src/main/resources/migration/changelog-v5.3.0.xml @@ -2446,6 +2446,13 @@ + CREATE EXTENSION IF NOT EXISTS PG_TRGM;