Add another index to device_lists_changes_in_room (#14534)

This helps avoid reading unnecessarily large amounts of data from the
table when querying with a set of room IDs.
This commit is contained in:
Erik Johnston 2022-11-23 14:09:00 +00:00 committed by GitHub
parent 4ae967cf63
commit f38d7d79c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View file

@ -1441,6 +1441,13 @@ class DeviceBackgroundUpdateStore(SQLBaseStore):
self._remove_duplicate_outbound_pokes,
)
self.db_pool.updates.register_background_index_update(
"device_lists_changes_in_room_by_room_index",
index_name="device_lists_changes_in_room_by_room_idx",
table="device_lists_changes_in_room",
columns=["room_id", "stream_id"],
)
async def _drop_device_list_streams_non_unique_indexes(
self, progress: JsonDict, batch_size: int
) -> int: