Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add an index to make membership queries faster #1867

Merged
merged 1 commit into from Feb 1, 2017

Conversation

Projects
None yet
2 participants
Owner

erikjohnston commented Jan 31, 2017

No description provided.

+ self.CURRENT_STATE_INDEX_UPDATE_NAME,
+ index_name="current_state_events_member_index",
+ table="current_state_events",
+ columns=["state_key"],
@NegativeMjark

NegativeMjark Feb 1, 2017

Contributor

should this be ["room_id", "state_key"]?

@NegativeMjark

NegativeMjark Feb 1, 2017 edited

Contributor

Oh I see, this for rooms_for_user so you want to look up by user_id = state_key.

@erikjohnston

erikjohnston Feb 1, 2017

Owner

No because we're looking up the room. The query we're optimising is essentially:

SELECT * FROM current_state_events WHERE type = 'm.room.member' AND state_key = ?

The type is in the where clause.

@NegativeMjark

NegativeMjark Feb 1, 2017

Contributor

And the users_in_room is already handled by the (room_id, type, state_key) index.

@erikjohnston erikjohnston merged commit 88a4d54 into develop Feb 1, 2017

8 checks passed

Sytest Dendron (Commit) Build #1450 origin/erikj/member_index succeeded in 10 min
Details
Sytest Dendron (Merged PR) Build finished.
Details
Sytest Postgres (Commit) Build #2267 origin/erikj/member_index succeeded in 5 min 44 sec
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Commit) Build #2336 origin/erikj/member_index succeeded in 5 min 57 sec
Details
Sytest SQLite (Merged PR) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@erikjohnston erikjohnston deleted the erikj/member_index branch Mar 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment