summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorErik Johnston <erikj@matrix.org>2023-11-17 14:15:44 +0000
committerGitHub <noreply@github.com>2023-11-17 14:15:44 +0000
commit9c02ef21e05a54b09a49ab8200160b578cdb8920 (patch)
tree794ee5607168115c34fcc6ab3595e53e5a39b422 /synapse/storage/databases
parentAlso discard 'caches' and 'backfill' stream POSITIONS (#16655) (diff)
downloadsynapse-9c02ef21e05a54b09a49ab8200160b578cdb8920.tar.xz
Speed up purge room by adding index (#16657)
What it says on the tin
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/event_push_actions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py
index 39556481ff..dd8957680a 100644
--- a/synapse/storage/databases/main/event_push_actions.py
+++ b/synapse/storage/databases/main/event_push_actions.py
@@ -311,6 +311,14 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
             self._background_drop_null_thread_id_indexes,
         )
 
+        # Add a room ID index to speed up room deletion
+        self.db_pool.updates.register_background_index_update(
+            "event_push_summary_index_room_id",
+            index_name="event_push_summary_index_room_id",
+            table="event_push_summary",
+            columns=["room_id"],
+        )
+
     async def _background_drop_null_thread_id_indexes(
         self, progress: JsonDict, batch_size: int
     ) -> int: