diff options
author | Erik Johnston <erik@matrix.org> | 2017-01-31 15:15:41 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-01-31 15:15:57 +0000 |
commit | 21b73757780cc8609e895cd851a3b5072c8a7e32 (patch) | |
tree | 6dbc1994d95ca03f840b44bf02e9a41693368e3a /synapse/storage/state.py | |
parent | Merge pull request #1864 from matrix-org/erikj/device_list_fixes (diff) | |
download | synapse-21b73757780cc8609e895cd851a3b5072c8a7e32.tar.xz |
Add an index to make membership queries faster
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r-- | synapse/storage/state.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index d1d653327c..1b3800eb6a 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -49,6 +49,7 @@ class StateStore(SQLBaseStore): STATE_GROUP_DEDUPLICATION_UPDATE_NAME = "state_group_state_deduplication" STATE_GROUP_INDEX_UPDATE_NAME = "state_group_state_type_index" + CURRENT_STATE_INDEX_UPDATE_NAME = "current_state_members_idx" def __init__(self, hs): super(StateStore, self).__init__(hs) @@ -60,6 +61,13 @@ class StateStore(SQLBaseStore): self.STATE_GROUP_INDEX_UPDATE_NAME, self._background_index_state, ) + self.register_background_index_update( + self.CURRENT_STATE_INDEX_UPDATE_NAME, + index_name="current_state_events_member_index", + table="current_state_events", + columns=["state_key"], + where_clause="type='m.room.member'", + ) @defer.inlineCallbacks def get_state_groups_ids(self, room_id, event_ids): |