diff --git a/packages/db/migrations/0186.do.labels_index_on_library_item.sql b/packages/db/migrations/0186.do.labels_index_on_library_item.sql new file mode 100755 index 000000000..fee9f5f81 --- /dev/null +++ b/packages/db/migrations/0186.do.labels_index_on_library_item.sql @@ -0,0 +1,5 @@ +-- Type: DO +-- Name: labels_index_on_library_item +-- Description: Add index on labels columns to library_item tables for better performance + +CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_library_item_state_label_names ON omnivore.library_item USING GIN (lower(array_cat(label_names, highlight_labels)::text)); diff --git a/packages/db/migrations/0186.undo.labels_index_on_library_item.sql b/packages/db/migrations/0186.undo.labels_index_on_library_item.sql new file mode 100755 index 000000000..fb37d783a --- /dev/null +++ b/packages/db/migrations/0186.undo.labels_index_on_library_item.sql @@ -0,0 +1,9 @@ +-- Type: UNDO +-- Name: more_index_on_library_item +-- Description: Add index on labels columns to library_item tables for better performance + +BEGIN; + +DROP INDEX IF EXISTS idx_library_item_state_label_names; + +COMMIT;