From d8d7049e801711fa2423f2dcd3f66d1a32a69301 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Fri, 15 Jul 2022 12:41:51 -0700 Subject: [PATCH 1/2] improve query performance --- synapse/storage/databases/main/roommember.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index 71a65d565a5b..cf1b06871e39 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -243,7 +243,7 @@ def _get_subset_users_in_room_with_profiles( txn: LoggingTransaction, ) -> Dict[str, ProfileInfo]: clause, ids = make_in_list_sql_clause( - self.database_engine, "m.user_id", user_ids + self.database_engine, "c.state_key", user_ids ) sql = """ From 4fabae498f49d19917f93b95d785bc282faef86b Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Fri, 15 Jul 2022 13:16:24 -0700 Subject: [PATCH 2/2] newsfragment --- changelog.d/13299.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/13299.misc diff --git a/changelog.d/13299.misc b/changelog.d/13299.misc new file mode 100644 index 000000000000..a9d5566873f4 --- /dev/null +++ b/changelog.d/13299.misc @@ -0,0 +1 @@ +Improve performance of query `_get_subset_users_in_room_with_profiles`.