improve data migration speed
This commit is contained in:
12
packages/db/migrations/0128.do.create_index_for_foreign_key.sql
Executable file
12
packages/db/migrations/0128.do.create_index_for_foreign_key.sql
Executable file
@ -0,0 +1,12 @@
|
||||
-- Type: DO
|
||||
-- Name: create_index_for_foreign_key
|
||||
-- Description: Create index for foreign keys on entity_label and highlight tables
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS entity_labels_library_item_id_idx ON omnivore.entity_labels(library_item_id)
|
||||
CREATE INDEX IF NOT EXISTS entity_labels_highlight_id_idx ON omnivore.entity_labels(highlight_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS highlight_library_item_id_idx ON omnivore.highlight (library_item_id);
|
||||
|
||||
COMMIT;
|
||||
12
packages/db/migrations/0128.undo.create_index_for_foreign_key.sql
Executable file
12
packages/db/migrations/0128.undo.create_index_for_foreign_key.sql
Executable file
@ -0,0 +1,12 @@
|
||||
-- Type: UNDO
|
||||
-- Name: create_index_for_foreign_key
|
||||
-- Description: Create index for foreign keys on entity_label and highlight tables
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS highlight_library_item_id_idx;
|
||||
|
||||
DROP INDEX IF EXISTS entity_labels_highlight_id_idx;
|
||||
DROP INDEX IF EXISTS entity_labels_library_item_id_idx;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user