summary refs log tree commit diff
path: root/synapse/storage/databases/main/e2e_room_keys.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-10-10 10:33:39 +0100
committerGitHub <noreply@github.com>2023-10-10 10:33:39 +0100
commit28fd28e92e9743ae98833fdb2a233aee64568a06 (patch)
tree0f344aae91e8d2a6c944d278ea8b137d6e278a48 /synapse/storage/databases/main/e2e_room_keys.py
parentDisable statement timeout whilst purging rooms (#16455) (diff)
downloadsynapse-28fd28e92e9743ae98833fdb2a233aee64568a06.tar.xz
Add DB indices to speed up purging rooms (#16457)
Diffstat (limited to 'synapse/storage/databases/main/e2e_room_keys.py')
-rw-r--r--synapse/storage/databases/main/e2e_room_keys.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/e2e_room_keys.py b/synapse/storage/databases/main/e2e_room_keys.py
index bc7c6a6346..aac4cfb054 100644
--- a/synapse/storage/databases/main/e2e_room_keys.py
+++ b/synapse/storage/databases/main/e2e_room_keys.py
@@ -53,6 +53,13 @@ class EndToEndRoomKeyBackgroundStore(SQLBaseStore):
     ):
         super().__init__(database, db_conn, hs)
 
+        self.db_pool.updates.register_background_index_update(
+            update_name="e2e_room_keys_index_room_id",
+            index_name="e2e_room_keys_room_id",
+            table="e2e_room_keys",
+            columns=("room_id",),
+        )
+
         self.db_pool.updates.register_background_update_handler(
             "delete_e2e_backup_keys_for_deactivated_users",
             self._delete_e2e_backup_keys_for_deactivated_users,