summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/storage/databases/main/event_federation.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index c3bdfe1e5a..9b3ced9edb 100644
--- a/synapse/storage/databases/main/event_federation.py
+++ b/synapse/storage/databases/main/event_federation.py
@@ -406,8 +406,11 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas
         # also returning large quantities of redundant data (which can make it a
         # lot slower).
 
-        txn.execute("SET LOCAL jit = off")
-        txn.execute("SET LOCAL enable_seqscan = off")
+        if isinstance(txn.database_engine, PostgresEngine):
+            # JIT and sequential scans sometimes get hit on this code path, which
+            # can make the queries much more expensive
+            txn.execute("SET LOCAL jit = off")
+            txn.execute("SET LOCAL enable_seqscan = off")
 
         sql = """
             WITH RECURSIVE links(chain_id) AS (