Skip to content

Commit d201868

Browse files
committed
Suggest copy_records_to_table() for the purpose of bulk insert.
Connection.executemany() is not the fastest choice for bulk insert, copy_records_to_table() is a better choice, so make it easier to find by putting a note in executemany() documentation. See #346 for an example of a performance confusion.
1 parent a6fdf5c commit d201868

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

asyncpg/connection.py

+6
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ async def executemany(self, command: str, args, *, timeout: float=None):
291291
:param float timeout: Optional timeout value in seconds.
292292
:return None: This method discards the results of the operations.
293293
294+
.. note::
295+
296+
When inserting a large number of rows,
297+
use :meth:`Connection.copy_records_to_table()` instead,
298+
it is much more efficient for this purpose.
299+
294300
.. versionadded:: 0.7.0
295301
296302
.. versionchanged:: 0.11.0

0 commit comments

Comments
 (0)