Re: autocommit (true/false) for more than 1 million records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 22, 2014 at 1:49 PM, Emi Lu <emilu@xxxxxxxxxxxxxxxxx> 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)

In general it is better to use COPY (however JDBC for 8.3. exposes that), as that is designed specifically for bulk loading.

Then it doesn't matter whether autocommit is on or off, because the COPY is a single statement.

Cheers,

Jeff

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux