From: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: autocommit (true/false) for more than 1 million records
Date: Fri, 22 Aug 2014 13:58:34 -0700 (PDT)
Message-ID: <1408741114012-5815946.post@n5.nabble.com> (raw)
In-Reply-To: <53F7ACF4.1010604@encs.concordia.ca>
References: <53F7ACF4.1010604@encs.concordia.ca>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Emi Lu-2 wrote
> Hello,
>
> Trying to insert into one table with 1 million records through java JDBC
> into psql8.3. May I know (1) or (2) is better please?
>
> (1) set autocommit(true)
> (2) set autocommit(false)
> commit every n records (e.g., 100, 500, 1000, etc)
>
> Thanks a lot!
> Emi
Typically the larger the n the better. Locking and risk of data loss on a
failure are the tradeoffs to consider. Other factors, like memory, make
choosing too large an n bad so using 500,000 is probably wrong but 500 is
probably overly conservative. Better advice depends on context and
hardware.
You should also consider upgrading to a newer, supported, version of
PostgreSQL.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/autocommit-true-false-for-more-than-1-million-records-tp5815...
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: david.g.johnston@gmail.com
Subject: Re: autocommit (true/false) for more than 1 million records
In-Reply-To: <1408741114012-5815946.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox