Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

No need for the extra join since membership is built-in to current_state_events #15731

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15731.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove redundant table join with `room_memberships` when doing a `is_host_joined()`/`is_host_invited()` call (`membership` is already part of the `current_state_events`).
7 changes: 3 additions & 4 deletions synapse/storage/databases/main/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,10 @@ async def _check_host_room_membership(
raise Exception("Invalid host name")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


sql = """
SELECT state_key FROM current_state_events AS c
INNER JOIN room_memberships AS m USING (event_id)
WHERE m.membership = ?
SELECT state_key FROM current_state_events
WHERE membership = ?
AND type = 'm.room.member'
AND c.room_id = ?
AND room_id = ?
AND state_key LIKE ?
LIMIT 1
"""
Expand Down