summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-08-19 10:54:32 +0100
committerGitHub <noreply@github.com>2016-08-19 10:54:32 +0100
commit290763f5596920cd12c89bf37614d4e8a3e5a6b9 (patch)
treed8e17dfa3d14b0925ad54171aa0b860ff9074eef /synapse/storage
parentMerge pull request #1026 from matrix-org/paul/thirdpartylookup (diff)
parentMake get_new_events_for_appservice use indices (diff)
downloadsynapse-290763f5596920cd12c89bf37614d4e8a3e5a6b9.tar.xz
Merge pull request #1029 from matrix-org/erikj/appservice_stream
Make get_new_events_for_appservice use indices
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/appservice.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py
index b496b918b7..a854a87eab 100644
--- a/synapse/storage/appservice.py
+++ b/synapse/storage/appservice.py
@@ -366,8 +366,11 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
         def get_new_events_for_appservice_txn(txn):
             sql = (
                 "SELECT e.stream_ordering, e.event_id"
-                " FROM events AS e, appservice_stream_position AS a"
-                " WHERE a.stream_ordering < e.stream_ordering AND e.stream_ordering <= ?"
+                " FROM events AS e"
+                " WHERE"
+                " (SELECT stream_ordering FROM appservice_stream_position)"
+                "     < e.stream_ordering"
+                " AND e.stream_ordering <= ?"
                 " ORDER BY e.stream_ordering ASC"
                 " LIMIT ?"
             )