Re: autocommit (true/false) for more than 1 million records - Mailing list pgsql-performance

From Emi Lu
Subject Re: autocommit (true/false) for more than 1 million records
Date
Msg-id 53FB3CB7.8010104@encs.concordia.ca
Whole thread Raw
In response to Re: autocommit (true/false) for more than 1 million records  (Stephen Frost <sfrost@snowman.net>)
Responses Re: autocommit (true/false) for more than 1 million records  (David Johnston <david.g.johnston@gmail.com>)
Re: autocommit (true/false) for more than 1 million records  (Felipe Santos <felipepts@gmail.com>)
List pgsql-performance
Good morning,
>>>> 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?
> The improvement drops off pretty quickly in my experience, but it
> depends on the size of the records and other things.
The table is huge with almost 170 columns.

> Try it and see..?  It's almost certainly going to depend on your
> specific environment.
Can you let me know what are the "specific environment" please? Such as:
......

By the way, could someone let me know why set autocommit(false) is for
sure faster than true please? Or, some online docs talk about this.

Thanks a lot!
Emi



pgsql-performance by date:

Previous
From: Stephen Frost
Date:
Subject: Re: autocommit (true/false) for more than 1 million records
Next
From: David Johnston
Date:
Subject: Re: autocommit (true/false) for more than 1 million records