summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-01-09 16:30:30 +0000
committerMatthew Hodgson <matthew@matrix.org>2018-01-09 16:30:30 +0000
commite365ad329f3c7e12bb2126217acbc62bdf0b9aec (patch)
treebeb2ed15ce3af9f68e4e0c24862d72e38ff8bd4b /synapse/storage
parentavoid 80s GIN inserts by tweaking work_mem (diff)
downloadsynapse-e365ad329f3c7e12bb2126217acbc62bdf0b9aec.tar.xz
oops, tweak work_mem when actually storing
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/room.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 23688430b7..9e2bf1ab48 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -310,6 +310,7 @@ class RoomStore(SQLBaseStore):
 
     def _store_event_search_txn(self, txn, event, key, value):
         if isinstance(self.database_engine, PostgresEngine):
+            txn.execute("SET work_mem='256KB'")
             sql = (
                 "INSERT INTO event_search"
                 " (event_id, room_id, key, vector, stream_ordering, origin_server_ts)"
@@ -323,6 +324,7 @@ class RoomStore(SQLBaseStore):
                     event.origin_server_ts,
                 )
             )
+            txn.execute("RESET work_mem")
         elif isinstance(self.database_engine, Sqlite3Engine):
             sql = (
                 "INSERT INTO event_search (event_id, room_id, key, value)"