summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/data_stores/main/events_bg_updates.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/storage/data_stores/main/events_bg_updates.py b/synapse/storage/data_stores/main/events_bg_updates.py
index 448048e11d..c8168f6926 100644
--- a/synapse/storage/data_stores/main/events_bg_updates.py
+++ b/synapse/storage/data_stores/main/events_bg_updates.py
@@ -518,7 +518,8 @@ class EventsBackgroundUpdatesStore(BackgroundUpdateStore):
             txn.execute(
                 """
                 SELECT event_id, json FROM event_json
-                WHERE event_id > ?
+                LEFT JOIN event_labels USING (event_id)
+                WHERE event_id > ? AND label IS NULL
                 LIMIT ?
                 """,
                 (last_event_id, batch_size)