diff options
author | Erik Johnston <erikj@jki.re> | 2017-02-01 11:44:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 11:44:27 +0000 |
commit | 88a4d54883d64c8059cde1f8215d7e97644dac85 (patch) | |
tree | de27b029701026f1333589aea838e0fe0ba078c6 /synapse/storage/state.py | |
parent | Up get_latest_event_ids_in_room cache (diff) | |
parent | Add an index to make membership queries faster (diff) | |
download | synapse-88a4d54883d64c8059cde1f8215d7e97644dac85.tar.xz |
Merge pull request #1867 from matrix-org/erikj/member_index
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): |