Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 72626b7

Browse files
authored
Fix thread BG update to not seq scan event_json (#11192)
For some reason the query optimiser decided to seq scan both tables, rather than index scanning `event_json`.
1 parent 2dbef6c commit 72626b7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog.d/11192.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Experimental support for the thread relation defined in [MSC3440](https://github.com/matrix-org/matrix-doc/pull/3440).

synapse/storage/databases/main/events_bg_updates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ def _event_thread_relation_txn(txn: LoggingTransaction) -> int:
11081108
"""
11091109
SELECT event_id, json FROM event_json
11101110
LEFT JOIN event_relations USING (event_id)
1111-
WHERE event_id > ? AND relates_to_id IS NULL
1111+
WHERE event_id > ? AND event_relations.event_id IS NULL
11121112
ORDER BY event_id LIMIT ?
11131113
""",
11141114
(last_event_id, batch_size),

0 commit comments

Comments
 (0)