From 498bf0d0ba95b8dd598214a67759b1dab7cf8678 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:26:34 +1000 Subject: [PATCH] feat(db): add indices for `board_images` --- .../app/services/board_image_record_storage.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/invokeai/app/services/board_image_record_storage.py b/invokeai/app/services/board_image_record_storage.py index abebe8c0a0..851e8502e1 100644 --- a/invokeai/app/services/board_image_record_storage.py +++ b/invokeai/app/services/board_image_record_storage.py @@ -102,6 +102,20 @@ class SqliteBoardImageRecordStorage(BoardImageRecordStorageBase): """ ) + # Add index for board id + self._cursor.execute( + """--sql + CREATE INDEX IF NOT EXISTS idx_board_images_board_id ON board_images (board_id); + """ + ) + + # Add index for board id, sorted by created_at + self._cursor.execute( + """--sql + CREATE INDEX IF NOT EXISTS idx_board_images_board_id_created_at ON board_images (board_id, created_at); + """ + ) + # Add trigger for `updated_at`. self._cursor.execute( """--sql