Re: Really bad insert performance: what did I do wrong? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Really bad insert performance: what did I do wrong?
Date
Msg-id 2703.1045887827@sss.pgh.pa.us
Whole thread Raw
In response to Re: Really bad insert performance: what did I do wrong?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-performance
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> 3:  Inserting ALL 700,000 rows in one transaction is probably not optimal.
> Try putting a test in every 1,000 or 10,000 rows to toss a "commit;begin;"
> pair at the database while loading.  Inserting all 700,000 rows at once
> means postgresql can't recycle the transaction logs, so you'll have
> 700,000 rows worth of data in the transaction logs waiting for you to
> commit at the end.

That was true in 7.1.0, but we got rid of that behavior *very* quickly
(by 7.1.3, according to the release notes).  Long transactions do not
currently stress the WAL storage any more than the same amount of work
in short transactions.

Which is not to say that there's anything wrong with divvying the work
into 1000-row-or-so transactions.  I agree that that's enough to push
the per-transaction overhead down into the noise.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Really bad insert performance: what did I do wrong?
Next
From: Josh Berkus
Date:
Subject: Re: performance issues for processing more then 150000