You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RoomWorkerStore.get_rooms_paginate DB store method contains some slow SQL queries. This method is currently only called when hitting the List Room Admin API. The current codebase contains this query:
INNER JOIN room_stats_current curr USING (room_id)
INNER JOIN rooms USING (room_id)
{where}
ORDER BY {order_by} {direction}, state.room_id {direction}
LIMIT ?
OFFSET ?
""".format(
where=where_statement,
order_by=order_by_column,
direction="ASC"iforder_by_ascelse"DESC",
)
Due to the two INNER JOINs, the statement takes about 700ms to execute on matrix.org (and this is after caching, as I ran the statement once before attempting to ANALYZE it).
These joins are necessary to access metadata about rooms, which is spread across multiple tables. For instance, the rooms table contains an is_public column, which allows for filtering room results based on whether a room is published in the public room directory.
Can we consolidate this information into a single table somehow? Or is there a faster way to access information across multiple tables than INNER JOINs?
The text was updated successfully, but these errors were encountered:
The
RoomWorkerStore.get_rooms_paginate
DB store method contains some slow SQL queries. This method is currently only called when hitting the List Room Admin API. The current codebase contains this query:synapse/synapse/storage/databases/main/room.py
Lines 703 to 723 in f1c4dfb
Due to the two
INNER JOIN
s, the statement takes about 700ms to execute on matrix.org (and this is after caching, as I ran the statement once before attempting toANALYZE
it).https://github.com/element-hq/synapse/pull/17276/files#r1631162300 added a similar set of
INNER JOIN
s to thecount_sql
query.These joins are necessary to access metadata about rooms, which is spread across multiple tables. For instance, the
rooms
table contains anis_public
column, which allows for filtering room results based on whether a room is published in the public room directory.Can we consolidate this information into a single table somehow? Or is there a faster way to access information across multiple tables than
INNER JOIN
s?The text was updated successfully, but these errors were encountered: