Add index on timestamp_added (#1381)
authorMelvyn Harbour <melharbour@gmail.com>
Tue, 18 Jun 2024 14:35:37 +0000 (15:35 +0100)
committerGitHub <noreply@github.com>
Tue, 18 Jun 2024 14:35:37 +0000 (16:35 +0200)
music_assistant/server/controllers/music.py

index 575fee318fcd32733cac4a2e3520da1477728d65..07db9324b1ab89b3c0dbb94c64ea81746f7276b9 100644 (file)
@@ -1108,6 +1108,11 @@ class MusicController(CoreController):
             await self.database.execute(
                 f"CREATE INDEX IF NOT EXISTS {db_table}_external_ids_idx on {db_table}(external_ids);"  # noqa: E501
             )
+            # index on timestamp_added
+            await self.database.execute(
+                f"CREATE INDEX IF NOT EXISTS {db_table}_timestamp_added_idx "
+                f"on {db_table}(timestamp_added);"
+            )
 
         # indexes on provider_mappings table
         await self.database.execute(