diff options
author | Erik Johnston <erik@matrix.org> | 2021-01-21 14:44:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 14:44:12 +0000 |
commit | 7a43482f1916622967f5a4b389f93944dd5deb07 (patch) | |
tree | 067807264e4296afce13edae43743bc0ee281928 /synapse/storage/database.py | |
parent | Add tests for List Users Admin API (#9045) (diff) | |
download | synapse-7a43482f1916622967f5a4b389f93944dd5deb07.tar.xz |
Use execute_batch in more places (#9188)
* Use execute_batch in more places * Newsfile
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r-- | synapse/storage/database.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py index c7220bc778..d2ba4bd2fc 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -262,6 +262,12 @@ class LoggingTransaction: return self.txn.description def execute_batch(self, sql: str, args: Iterable[Iterable[Any]]) -> None: + """Similar to `executemany`, except `txn.rowcount` will not be correct + afterwards. + + More efficient than `executemany` on PostgreSQL + """ + if isinstance(self.database_engine, PostgresEngine): from psycopg2.extras import execute_batch # type: ignore |