summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-30 13:52:28 +0100
committerErik Johnston <erik@matrix.org>2015-04-30 14:02:06 +0100
commit2366d287806f267e078ab21bdf3abf2b67457f03 (patch)
tree74af678ece13da1ae766129164d05b98bf60aeb6 /synapse/storage/state.py
parentAdd an access_log (diff)
downloadsynapse-2366d287806f267e078ab21bdf3abf2b67457f03.tar.xz
Don't needlessly join on state_events
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 553ba9dd1f..c282fcf7c1 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -136,17 +136,16 @@ class StateStore(SQLBaseStore):
         sql = (
             "SELECT e.*, (%(redacted)s) AS redacted FROM events as e "
             "INNER JOIN current_state_events as c ON e.event_id = c.event_id "
-            "INNER JOIN state_events as s ON e.event_id = s.event_id "
             "WHERE c.room_id = ? "
         ) % {
             "redacted": del_sql,
         }
 
         if event_type and state_key is not None:
-            sql += " AND s.type = ? AND s.state_key = ? "
+            sql += " AND c.type = ? AND c.state_key = ? "
             args = (room_id, event_type, state_key)
         elif event_type:
-            sql += " AND s.type = ?"
+            sql += " AND c.type = ?"
             args = (room_id, event_type)
         else:
             args = (room_id, )