avoid 80s GIN inserts by tweaking work_mem
see https://github.com/matrix-org/synapse/issues/2753 for detailspull/2768/head
							parent
							
								
									3f9f1c50f3
								
							
						
					
					
						commit
						19f9227643
					
				|  | @ -106,6 +106,7 @@ class SearchStore(BackgroundUpdateStore): | |||
|                 event_search_rows.append((event_id, room_id, 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)" | ||||
|                     " VALUES (?,?,?,to_tsvector('english', ?))" | ||||
|  | @ -123,6 +124,9 @@ class SearchStore(BackgroundUpdateStore): | |||
|                 clump = event_search_rows[index:index + INSERT_CLUMP_SIZE] | ||||
|                 txn.executemany(sql, clump) | ||||
| 
 | ||||
|             if isinstance(self.database_engine, PostgresEngine): | ||||
|                 txn.execute("RESET work_mem") | ||||
| 
 | ||||
|             progress = { | ||||
|                 "target_min_stream_id_inclusive": target_min_stream_id, | ||||
|                 "max_stream_id_exclusive": min_stream_id, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Matthew Hodgson
						Matthew Hodgson