mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add an index of columns user_id and created_at to the library_item table for counting query
This commit is contained in:
parent
6f12b5e406
commit
465e5dc7d1
3 changed files with 17 additions and 3 deletions
|
|
@ -760,7 +760,7 @@ export const bulkActionResolver = authorized<
|
|||
},
|
||||
})
|
||||
|
||||
const batchSize = 50
|
||||
const batchSize = 20
|
||||
const searchArgs = {
|
||||
query,
|
||||
includePending: true,
|
||||
|
|
@ -779,13 +779,13 @@ export const bulkActionResolver = authorized<
|
|||
action,
|
||||
count,
|
||||
})
|
||||
// if there are less than 50 items, update them synchronously
|
||||
// if there are less than batchSize items, update them synchronously
|
||||
await batchUpdateLibraryItems(action, searchArgs, uid, labelIds, args)
|
||||
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
// if there are more than 50 items, update them asynchronously
|
||||
// if there are more than batchSize items, update them asynchronously
|
||||
const data = {
|
||||
userId: uid,
|
||||
action,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
-- Type: DO
|
||||
-- Name: add_user_id_created_at_index_to_library_item
|
||||
-- Description: Add an index of columns user_id and created_at to the library_item table for counting query
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS library_item_user_id_created_at_idx ON omnivore.library_item (user_id, created_at);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Type: UNDO
|
||||
-- Name: add_user_id_created_at_index_to_library_item
|
||||
-- Description: Add an index of columns user_id and created_at to the library_item table for counting query
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS omnivore.library_item_user_id_created_at_idx;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in a new issue