-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expose whether a room is a space in the Admin API #11934
Expose whether a room is a space in the Admin API #11934
Conversation
INNER JOIN event_json json USING (room_id) | ||
INNER JOIN state_events events USING (event_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a comparison of costs on my small database for get_rooms_paginate
.
It seems to be a big growth. I think we need some discussion to this: #11904 (comment)
explain
SELECT state.room_id, state.name, state.canonical_alias, curr.joined_members,
curr.local_users_in_room, rooms.room_version, rooms.creator,
state.encryption, state.is_federatable, rooms.is_public, state.join_rules,
state.guest_access, state.history_visibility, curr.current_state_events
FROM room_stats_state state
INNER JOIN room_stats_current curr USING (room_id)
INNER JOIN rooms USING (room_id);
QUERY PLAN
--------------------------------------------------------------------------------------
Hash Join (cost=11.31..16.20 rows=112 width=218)
Hash Cond: (state.room_id = curr.room_id)
-> Hash Join (cost=5.57..10.14 rows=114 width=262)
Hash Cond: (state.room_id = rooms.room_id)
-> Seq Scan on room_stats_state state (cost=0.00..4.24 rows=124 width=159)
-> Hash (cost=4.14..4.14 rows=114 width=103)
-> Seq Scan on rooms (cost=0.00..4.14 rows=114 width=103)
-> Hash (cost=4.22..4.22 rows=122 width=67)
-> Seq Scan on room_stats_current curr (cost=0.00..4.22 rows=122 width=67)
explain
SELECT state.room_id, state.name, state.canonical_alias, curr.joined_members,
curr.local_users_in_room, rooms.room_version, rooms.creator,
state.encryption, state.is_federatable, rooms.is_public, state.join_rules,
state.guest_access, state.history_visibility, curr.current_state_events,
json.json
FROM room_stats_state state
INNER JOIN room_stats_current curr USING (room_id)
INNER JOIN rooms USING (room_id)
INNER JOIN event_json json USING (room_id)
INNER JOIN state_events events USING (event_id);
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Hash Join (cost=639.49..5749.86 rows=8125 width=1289)
Hash Cond: (state.room_id = curr.room_id)
-> Hash Join (cost=633.74..5721.66 rows=8270 width=1389)
Hash Cond: (state.room_id = rooms.room_id)
-> Hash Join (cost=628.18..5691.67 rows=8995 width=1286)
Hash Cond: (json.room_id = state.room_id)
-> Hash Join (cost=622.39..5661.45 rows=8995 width=1127)
Hash Cond: (json.event_id = events.event_id)
-> Seq Scan on event_json json (cost=0.00..4982.49 rows=21549 width=1172)
-> Hash (cost=509.95..509.95 rows=8995 width=45)
-> Seq Scan on state_events events (cost=0.00..509.95 rows=8995 width=45)
-> Hash (cost=4.24..4.24 rows=124 width=159)
-> Seq Scan on room_stats_state state (cost=0.00..4.24 rows=124 width=159)
-> Hash (cost=4.14..4.14 rows=114 width=103)
-> Seq Scan on rooms (cost=0.00..4.14 rows=114 width=103)
-> Hash (cost=4.22..4.22 rows=122 width=67)
-> Seq Scan on room_stats_current curr (cost=0.00..4.22 rows=122 width=67)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dklimpel I guess, one should more efficiently store the room type
when the room is created. However, I did not dare such a big change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this would not be downwards compatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is possible to do this downwards compatible. But then it is not a "good first issue".
You need:
- a database update to extend the table with a new column
- update the function, which writes new rooms to database
- a background job to update database for all existing / old rooms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe I will do so in a month or so. I am a student and currently we have exam phase.
I think I won't have time to work on this. |
Closes #11904.
Signed-off by: Lukas Denk, [email protected]
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)