Add index to schema_set_yang_resources table 72/133572/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Tue, 7 Mar 2023 16:56:08 +0000 (16:56 +0000)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Wed, 8 Mar 2023 08:41:15 +0000 (08:41 +0000)
Currently, the database is sequentially scanning when deleting from
schema_set_yang_resources table as there are no indexes on the table.
Adding an index doubles performance of NCMP CM-handle deregistration.

Issue-ID: CPS-1535
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ia6ac7ef95d1662f49a77fc72112f1e29a67079ff

cps-ri/src/main/resources/changelog/changelog-master.yaml
cps-ri/src/main/resources/changelog/db/changes/17-add-index-to-schema-set-yang-resources.yaml [new file with mode: 0644]

index cb5392b..43a54ca 100644 (file)
@@ -1,6 +1,6 @@
 # ============LICENSE_START=======================================================
 # Copyright (c) 2021 Bell Canada.
-# Modifications Copyright (C) 2022 Nordix Foundation.
+# Modifications Copyright (C) 2022-2023 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -47,4 +47,6 @@ databaseChangeLog:
   - include:
       file: changelog/db/changes/15-rename-column-yang-resource-table.yaml
   - include:
-      file: changelog/db/changes/16-insert-cm-handle-state.yaml
\ No newline at end of file
+      file: changelog/db/changes/16-insert-cm-handle-state.yaml
+  - include:
+      file: changelog/db/changes/17-add-index-to-schema-set-yang-resources.yaml
diff --git a/cps-ri/src/main/resources/changelog/db/changes/17-add-index-to-schema-set-yang-resources.yaml b/cps-ri/src/main/resources/changelog/db/changes/17-add-index-to-schema-set-yang-resources.yaml
new file mode 100644 (file)
index 0000000..bc16725
--- /dev/null
@@ -0,0 +1,15 @@
+databaseChangeLog:
+  - changeSet:
+      author: cps
+      id: 17
+      changes:
+        - createIndex:
+            columns:
+              - column:
+                  name: schema_set_id
+            indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK
+            tableName: schema_set_yang_resources
+      rollback:
+        - dropIndex:
+            indexName: FKI_SCHEMA_SET_YANG_RESOURCES_SCHEMA_SET_ID_FK
+            tableName: schema_set_yang_resources