summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/12904.misc1
-rw-r--r--synapse/storage/databases/main/state.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/changelog.d/12904.misc b/changelog.d/12904.misc
new file mode 100644
index 0000000000..afca32471f
--- /dev/null
+++ b/changelog.d/12904.misc
@@ -0,0 +1 @@
+Pull out less state when handling gaps in room DAG.
diff --git a/synapse/storage/databases/main/state.py b/synapse/storage/databases/main/state.py
index ea5cbdac08..a07ad85582 100644
--- a/synapse/storage/databases/main/state.py
+++ b/synapse/storage/databases/main/state.py
@@ -167,8 +167,8 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
             )
 
             sql = f"""
-                SELECT e.event_id, e.room_id, e.type, e.state_key FROM events AS e
-                LEFT JOIN state_events USING (event_id)
+                SELECT e.event_id, e.room_id, e.type, se.state_key FROM events AS e
+                LEFT JOIN state_events se USING (event_id)
                 WHERE {clause}
             """