0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-04 05:38:57 +01:00

Remove pointless join

This commit is contained in:
Erik Johnston 2015-04-30 18:49:26 +01:00
parent 503e4d3d52
commit 8be5284e91

View file

@ -130,16 +130,15 @@ class StateStore(SQLBaseStore):
def get_current_state(self, room_id, event_type=None, state_key=""): def get_current_state(self, room_id, event_type=None, state_key=""):
def f(txn): def f(txn):
sql = ( sql = (
"SELECT e.event_id FROM events as e" "SELECT event_id FROM current_state_events"
" INNER JOIN current_state_events as c ON e.event_id = c.event_id" " WHERE room_id = ? "
" WHERE c.room_id = ? "
) )
if event_type and state_key is not None: if event_type and state_key is not None:
sql += " AND c.type = ? AND c.state_key = ? " sql += " AND type = ? AND state_key = ? "
args = (room_id, event_type, state_key) args = (room_id, event_type, state_key)
elif event_type: elif event_type:
sql += " AND c.type = ?" sql += " AND type = ?"
args = (room_id, event_type) args = (room_id, event_type)
else: else:
args = (room_id, ) args = (room_id, )