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

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-performance(at)postgresql(dot)org
Cc: sfrost(at)snowman(dot)net, david(dot)g(dot)johnston(at)gmail(dot)com
Subject: Re: autocommit (true/false) for more than 1 million records
Date: 2014-08-22 21:11:01
Message-ID: 53F7B1E5.6030507@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> *
>> 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)
> It depends on what you need.
>
> Data will be available to concurrent processes earlier with (1), while
> (2) will go faster.
No need to worry about the lock/loosing records because after data
loading will do a check. For now, I'd like the fastest way. Would you
suggest commit every 1000 or 3000 records?

Thanks a lot!
Emi

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stephen Frost 2014-08-22 21:21:15 Re: autocommit (true/false) for more than 1 million records
Previous Message Stephen Frost 2014-08-22 21:00:18 Re: autocommit (true/false) for more than 1 million records