diff options
author | Erik Johnston <erik@matrix.org> | 2015-05-13 14:39:05 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-05-13 14:39:05 +0100 |
commit | 6edff11a888d2c3f7a6749599fcb9d4974a76bbb (patch) | |
tree | 9277bb0a290e9c23b659eb3c2c99d667bc66dce5 /synapse/storage/state.py | |
parent | Temp turn off checking for rejections and redactions (diff) | |
download | synapse-6edff11a888d2c3f7a6749599fcb9d4974a76bbb.tar.xz |
Don't fetch redaction and rejection stuff for each event, so we can use index only scan
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r-- | synapse/storage/state.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index 6d7d576cb6..6d0ecf8dd9 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -85,8 +85,10 @@ class StateStore(SQLBaseStore): def fetch_events(txn, events): sql = ( - "SELECT e.internal_metadata, e.json " + "SELECT e.internal_metadata, e.json, r.redacts, rej.event_id " " FROM event_json as e" + " LEFT JOIN rejections as rej USING (event_id)" + " LEFT JOIN redactions as r ON e.event_id = r.redacts" " WHERE e.event_id IN (%s)" ) % (",".join(["?"]*len(events)),) @@ -95,7 +97,8 @@ class StateStore(SQLBaseStore): return [ self._get_event_from_row_txn( - txn, row[0], row[1], None + txn, row[0], row[1], row[2], + rejected_reason=row[3], ) for row in rows ] |