Skip to content

Commit

Permalink
Suggest copy_records_to_table() for the purpose of bulk insert.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
elprans committed Aug 26, 2018
1 parent a6fdf5c commit d201868
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions asyncpg/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ async def executemany(self, command: str, args, *, timeout: float=None):
:param float timeout: Optional timeout value in seconds.
:return None: This method discards the results of the operations.
.. note::
When inserting a large number of rows,
use :meth:`Connection.copy_records_to_table()` instead,
it is much more efficient for this purpose.
.. versionadded:: 0.7.0
.. versionchanged:: 0.11.0
Expand Down

0 comments on commit d201868

Please sign in to comment.