From 6bdde42a8f4436d0beb88c35d40975c138ea83c4 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 27 Oct 2021 11:58:59 +0100 Subject: [PATCH 1/2] Fix thread BG update to not seq scan event_json For some reason the query optimiser decided to seq scan both tables, rather than index scanning `event_json`. --- synapse/storage/databases/main/events_bg_updates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index f92d82487656..ae3a8a63e42f 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -1108,7 +1108,7 @@ def _event_thread_relation_txn(txn: LoggingTransaction) -> int: """ SELECT event_id, json FROM event_json LEFT JOIN event_relations USING (event_id) - WHERE event_id > ? AND relates_to_id IS NULL + WHERE event_id > ? AND event_relations.event_id IS NULL ORDER BY event_id LIMIT ? """, (last_event_id, batch_size), From 5eaf65d970c5a1c07a9b18d13b244f68df3adc67 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 27 Oct 2021 12:01:14 +0100 Subject: [PATCH 2/2] Newsfile --- changelog.d/11192.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11192.feature diff --git a/changelog.d/11192.feature b/changelog.d/11192.feature new file mode 100644 index 000000000000..76b0d280845e --- /dev/null +++ b/changelog.d/11192.feature @@ -0,0 +1 @@ +Experimental support for the thread relation defined in [MSC3440](https://github.com/matrix-org/matrix-doc/pull/3440).