From: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: autocommit (true/false) for more than 1 million records |
Date: | 2014-08-22 20:58:34 |
Message-ID: | 1408741114012-5815946.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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-tp5815943p5815946.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-08-22 21:00:18 | Re: autocommit (true/false) for more than 1 million records |
Previous Message | Emi Lu | 2014-08-22 20:49:56 | autocommit (true/false) for more than 1 million records |