Re: why autocommit mode is slow?

From: Vick Khera <vivek(at)khera(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: why autocommit mode is slow?
Date: 2011-04-08 13:00:05
Message-ID: BANLkTi=NdWUiG5nNqYpi0duAFgK--P=arA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 7, 2011 at 4:59 PM, Szymon Guz <mabewlun(at)gmail(dot)com> wrote:

> this is maybe a stupid question, but I don't know how to explain to my
> coworkers why performing many inserts in autocommit mode is so much slower
> than making all of them in one transaction.

as others have said, there is overhead in each transaction. the biggest of
these is the file sync to disk of the write-ahead log. on spinning media
this involves on average one rotation of the platter. when you batch the
inserts, you save that sync per insert.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2011-04-08 13:15:46 Re: PostgreSQL + FreeBSD memory configuration, and an issue
Previous Message Shianmiin 2011-04-08 12:43:07 Re: PostgreSQL backend process high memory usage issue