diff options
author | Erik Johnston <erik@matrix.org> | 2019-07-17 15:33:37 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-07-18 14:15:57 +0100 |
commit | 6de09e07a6f7d043589205c25594852900a6626b (patch) | |
tree | 0511584c8c2e6bb4d1c27e0715a4bea95b4a4a9a /synapse/storage/roommember.py | |
parent | Merge pull request #5597 from matrix-org/erikj/admin_api_cmd (diff) | |
download | synapse-6de09e07a6f7d043589205c25594852900a6626b.tar.xz |
Add membership column to current_state_events table.
It turns out that doing a join is surprisingly expensive for the DB to do when room_membership table is larger than the disk cache.
Diffstat (limited to 'synapse/storage/roommember.py')
-rw-r--r-- | synapse/storage/roommember.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 32cfd010a5..4946afe635 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -224,7 +224,7 @@ class RoomMemberWorkerStore(EventsWorkerStore): results = [] if membership_list: where_clause = "user_id = ? AND (%s) AND forgotten = 0" % ( - " OR ".join(["membership = ?" for _ in membership_list]), + " OR ".join(["m.membership = ?" for _ in membership_list]), ) args = [user_id] @@ -453,8 +453,8 @@ class RoomMemberWorkerStore(EventsWorkerStore): sql = """ SELECT state_key FROM current_state_events AS c - INNER JOIN room_memberships USING (event_id) - WHERE membership = 'join' + INNER JOIN room_memberships AS m USING (event_id) + WHERE m.membership = 'join' AND type = 'm.room.member' AND c.room_id = ? AND state_key LIKE ? |