From 98a2cbc10f71f902dfcfd5f35d9c916458a9ec30 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 16 May 2022 15:43:00 +0100 Subject: [PATCH] Fix query performance for /sync Broke in #12729. --- synapse/storage/databases/main/stream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/stream.py b/synapse/storage/databases/main/stream.py index 3c3137fe64c5..0373af86c82b 100644 --- a/synapse/storage/databases/main/stream.py +++ b/synapse/storage/databases/main/stream.py @@ -750,7 +750,7 @@ def _f(txn: LoggingTransaction) -> Optional[Tuple[int, int, str]]: WHERE room_id = ? AND stream_ordering <= ? AND NOT outlier - AND rejections.reason IS NULL + AND rejections.event_id IS NULL ORDER BY stream_ordering DESC LIMIT 1 """