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

Commit

Permalink
Fix thread BG update to not seq scan event_json (#11192)
Browse files Browse the repository at this point in the history
For some reason the query optimiser decided to seq scan both tables,
rather than index scanning `event_json`.
  • Loading branch information
erikjohnston committed Oct 27, 2021
1 parent 2dbef6c commit 72626b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/11192.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Experimental support for the thread relation defined in [MSC3440](https://github.com/matrix-org/matrix-doc/pull/3440).
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/events_bg_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 72626b7

Please sign in to comment.