Re: speed concerns with executemany()

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, Christophe Pettus <xof(at)thebuild(dot)com>
Cc: mike bayer <mike_mp(at)zzzcomputing(dot)com>, "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: speed concerns with executemany()
Date: 2016-12-24 00:58:18
Message-ID: 72b0ddc0-ee36-6a44-760f-7693f85e3304@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 12/23/2016 04:29 PM, Daniele Varrazzo wrote:
> On Sat, Dec 24, 2016 at 1:09 AM, Christophe Pettus <xof(at)thebuild(dot)com> wrote:
>> Are you running with the transaction isolation level set to ISOLATION_LEVEL_AUTOCOMMIT? If so, each of those INSERTs will be in its own transaction, and thus will go through the COMMIT overhead. That by itself wouldn't explain a jump that large (in most environments), but it will definitely be *much* slower.
>
> Why do you say this? Psycopg doesn't wrap statements in BEGIN/COMMIT
> when in autocommit mode. Are you referring about some implicit

I understood it did:

http://initd.org/psycopg/docs/usage.html#transactions-control

"It is possible to set the connection in autocommit mode: this way all
the commands executed will be immediately committed and no rollback is
possible. A few commands (e.g. CREATE DATABASE, VACUUM...) require to be
run outside any transaction: in order to be able to run these commands
from Psycopg, the connection must be in autocommit mode: you can use the
autocommit property (set_isolation_level() in older versions)."

> transaction created by the database?
>
> -- Daniele
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Christophe Pettus 2016-12-24 00:59:50 Re: speed concerns with executemany()
Previous Message Daniele Varrazzo 2016-12-24 00:29:14 Re: speed concerns with executemany()