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.