diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-10 13:33:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-10 13:43:35 -0400 |
| commit | 4fbeec9d61b6bcbb40ef931b2aa2c82bd6bc8379 (patch) | |
| tree | 3339c443406557f1f71d920258565ab0566f7c59 /doc/build/faq | |
| parent | 2b2cdee7994d4af8dbd3dab28a5588c02e974fc8 (diff) | |
| download | sqlalchemy-4fbeec9d61b6bcbb40ef931b2aa2c82bd6bc8379.tar.gz | |
Add fast execution helper support.
Added a new flag ``use_batch_mode`` to the psycopg2 dialect. This flag
enables the use of psycopg2's ``psycopg2.extras.execute_batch``
extension when the :class:`.Engine` calls upon ``cursor.executemany()``.
This extension provides a critical performance increase by over an order of magnitude
when running INSERT statements in batch. The flag is False by default
as it is considered to be experimental for now.
Change-Id: Ib88d28bc792958d47109f644ff1d08c897db4ff7
Fixes: #4109
Diffstat (limited to 'doc/build/faq')
| -rw-r--r-- | doc/build/faq/performance.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/build/faq/performance.rst b/doc/build/faq/performance.rst index d6ee557ea..fa298bdad 100644 --- a/doc/build/faq/performance.rst +++ b/doc/build/faq/performance.rst @@ -298,6 +298,12 @@ SQL generation and execution system that the ORM builds on top of is part of the :doc:`Core <core/tutorial>`. Using this system directly, we can produce an INSERT that is competitive with using the raw database API directly. +.. note:: + + When using the psycopg2 dialect, consider making use of the + :ref:`batch execution helpers <psycopg2_batch_mode>` feature of psycopg2, + now supported directly by the SQLAlchemy psycopg2 dialect. + Alternatively, the SQLAlchemy ORM offers the :ref:`bulk_operations` suite of methods, which provide hooks into subsections of the unit of work process in order to emit Core-level INSERT and UPDATE constructs with |
