summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
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 59a50a5df9..45afd42b3f 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -1272,14 +1272,13 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
 
             # Check if state groups are referenced
             sql = """
-                SELECT state_group, count(*) FROM event_to_state_groups
+                SELECT DISTINCT state_group FROM event_to_state_groups
                 LEFT JOIN events_to_purge AS ep USING (event_id)
                 WHERE state_group IN (%s) AND ep.event_id IS NULL
-                GROUP BY state_group
             """ % (",".join("?" for _ in current_search),)
             txn.execute(sql, list(current_search))
 
-            referenced = set(sg for sg, cnt in txn if cnt > 0)
+            referenced = set(sg for sg, in txn)
             referenced_groups |= referenced
 
             # We don't continue iterating up the state group graphs for state