pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Emi Lu <emilu@encs.concordia.ca>
Cc: pgsql-performance@postgresql.org
Cc: david.g.johnston@gmail.com
Subject: Re: autocommit (true/false) for more than 1 million records
Date: Fri, 22 Aug 2014 17:21:15 -0400
Message-ID: <20140822212115.GB16422@tamriel.snowman.net> (raw)
In-Reply-To: <53F7B1E5.6030507@encs.concordia.ca>
References: <53F7ACF4.1010604@encs.concordia.ca>
	<20140822210018.GZ16422@tamriel.snowman.net>
	<53F7B1E5.6030507@encs.concordia.ca>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

* Emi Lu (emilu@encs.concordia.ca) wrote:
> >*
> >>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.

Try it and see..?  It's almost certainly going to depend on your
specific environment.

	Thanks,

		Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (20+ messages)  latest in thread

Message-ID: <20140822212115.GB16422@tamriel.snowman.net>
Permalink:  ../20140822212115.GB16422@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20140822212115.GB16422@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: sfrost@snowman.net, emilu@encs.concordia.ca, david.g.johnston@gmail.com
  Subject: Re: autocommit (true/false) for more than 1 million records
  In-Reply-To: <20140822212115.GB16422@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox