add index for sorting by word_count
This commit is contained in:
6
packages/db/migrations/0157.do.library_item_user_id_word_count_idx.sql
Executable file
6
packages/db/migrations/0157.do.library_item_user_id_word_count_idx.sql
Executable file
@ -0,0 +1,6 @@
|
||||
-- Type: DO
|
||||
-- Name: library_item_user_id_word_count_idx
|
||||
-- Description: Add library_item_user_id_word_count_idx index on library_item table for user_id and word_count
|
||||
|
||||
-- create index for sorting concurrently to avoid locking
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS library_item_user_id_word_count_idx ON omnivore.library_item (user_id, word_count DESC NULLS LAST);
|
||||
9
packages/db/migrations/0157.undo.library_item_user_id_word_count_idx.sql
Executable file
9
packages/db/migrations/0157.undo.library_item_user_id_word_count_idx.sql
Executable file
@ -0,0 +1,9 @@
|
||||
-- Type: UNDO
|
||||
-- Name: library_item_user_id_word_count_idx
|
||||
-- Description: Add library_item_user_id_word_count_idx index on library_item table for user_id and word_count
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS library_item_user_id_word_count_idx;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user