Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKvwg-0005qW-Cq for pgsql-performance@arkaria.postgresql.org; Fri, 22 Aug 2014 21:00:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XKvwf-0005Pb-S1 for pgsql-performance@arkaria.postgresql.org; Fri, 22 Aug 2014 21:00:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XKvwe-0005NT-OL for pgsql-performance@postgresql.org; Fri, 22 Aug 2014 21:00:24 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKvwa-0001Rr-1s for pgsql-performance@postgresql.org; Fri, 22 Aug 2014 21:00:23 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 008635F8DF; Fri, 22 Aug 2014 17:00:18 -0400 (EDT) Date: Fri, 22 Aug 2014 17:00:18 -0400 From: Stephen Frost To: Emi Lu Cc: pgsql-performance@postgresql.org Subject: Re: autocommit (true/false) for more than 1 million records Message-ID: <20140822210018.GZ16422@tamriel.snowman.net> References: <53F7ACF4.1010604@encs.concordia.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3FujFKT3/J1n33gA" Content-Disposition: inline In-Reply-To: <53F7ACF4.1010604@encs.concordia.ca> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.11.0-19-generic (x86_64) X-Uptime: 16:59:47 up 136 days, 7:18, 11 users, load average: 0.03, 0.06, 0.09 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --3FujFKT3/J1n33gA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Emi Lu (emilu@encs.concordia.ca) wrote: > Hello, >=20 > 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? >=20 > (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. Thanks, =09 Stephen --3FujFKT3/J1n33gA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT969iAAoJEO1sijiDR2RVGecP/Ath+73ePoJU+a1MYBHM2CsK r6EVV11xfJgyviJ8lPgtCEbWg2IqMaUYD8nUMlx3X+A6IhZoroNKrkdKtn4mDKM7 Nhr++Y5wAUb/27lGJGvG2gzYyIjNMnrYS5U3pucLbR8NC2eEN+aQuIx8F1IOS7Lm PxYnnahRnDDAOozmu14HzpAE7IKReLRWPMnjudd7YSNrjHCh7GKrvjh1NDB/fWbg WNa26Em6m4p/k/pwt/Z/CsZCC+j1OCDihovDTGN2ydqSZDlk3g7Lf/MUKPGJeWHR tX4zuo9NxZN3TXtXIBn6MeZDw2SirOGHYSW2i0BtF7SVeCEsJdhoSHOkP/zOFSRh S3OkH+/QdeOa38jJKJjY3CT2F4jVr1v7n5B4Lx8y625sKUy5HW6lSaIBPICA0xXa l/hbVz1vxSwvm/k9sfha9KQNx4CYtqr2IeqSybf1STFoWjRhA2QAx+LGKUCLCcPE E+EBpLkrb6UPVrBqE4hDHwbW+1fC5KOhtBpW+OoLGP4iqtCpJF8k9X1Gi6duWu2g P5nIccU1jOmBDJ0ue2atyA8n3oYtKA7DeDR7o6FtcFs5+vr1yhyZuofhTV9XPvL4 GkKWFHiek1B7xfT6By+kW7UTO8PcunP7rua3ZhPb2EtrjeOvVmckUpy2JoAMLp2Z RV1HDBg9h3RuQ1SQjc8P =mRzr -----END PGP SIGNATURE----- --3FujFKT3/J1n33gA--