mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:54:47 -04:00
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.
This commit is contained in:
parent
c831c5b2bb
commit
6de09e07a6
5 changed files with 41 additions and 20 deletions
|
@ -618,15 +618,15 @@ class UserDirectoryStore(StateDeltasStore, BackgroundUpdateStore):
|
|||
sql = """
|
||||
SELECT room_id FROM (
|
||||
SELECT c.room_id FROM current_state_events AS c
|
||||
INNER JOIN room_memberships USING (event_id)
|
||||
INNER JOIN room_memberships AS m USING (event_id)
|
||||
WHERE type = 'm.room.member'
|
||||
AND membership = 'join'
|
||||
AND m.membership = 'join'
|
||||
AND state_key = ?
|
||||
) AS f1 INNER JOIN (
|
||||
SELECT c.room_id FROM current_state_events AS c
|
||||
INNER JOIN room_memberships USING (event_id)
|
||||
INNER JOIN room_memberships AS m USING (event_id)
|
||||
WHERE type = 'm.room.member'
|
||||
AND membership = 'join'
|
||||
AND m.membership = 'join'
|
||||
AND state_key = ?
|
||||
) f2 USING (room_id)
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue