1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 87ae961ccd..3a17a723fe 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -257,7 +257,7 @@ class StreamStore(SQLBaseStore):
sql = (
"SELECT * FROM events "
"WHERE room_id = ? AND stream_ordering <= ? "
- "ORDER BY topological_ordering, stream_ordering DESC LIMIT ? "
+ "ORDER BY topological_ordering DESC, stream_ordering DESC LIMIT ? "
)
rows = yield self._execute_and_decode(
|