X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 45247D1B193 for ; Mon, 31 May 2004 21:38:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 90417-10 for ; Mon, 31 May 2004 21:38:27 -0300 (ADT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 753B7D1B173 for ; Mon, 31 May 2004 21:38:22 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1BUxIN-0000Ud-00; Tue, 01 Jun 2004 12:38:23 +1200 Message-ID: <40BBD012.9070809@opencloud.com> Date: Tue, 01 Jun 2004 12:38:42 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sharib Anis Cc: "pgsql-jdbc@postgresql.org" Subject: Re: Postgresql 7.4.2 and OutOfMemoryError References: <005001c44304$c75ede70$1864000a@SHARIB> In-Reply-To: <005001c44304$c75ede70$1864000a@SHARIB> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.1 tagged_above=0.0 required=5.0 tests=DRASTIC_REDUCED, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/192 X-Sequence-Number: 10202 Sharib Anis wrote: > Hello All, > > I'm using Postgresql for our java application. I started with Postgres > 7.2.1 and everything worked fine. Then however, I decided to upgrade to > 7.4.2. > > Since then I'm facing this frustrating problem where I'm always getting > OutOfMemoryError. Basically there is an operation which involves > inserts/updates in batches of 20K records. With the earlier version of > Postgresql and driver, it worked smoothly, but not now. Any ideas why? > What should I do to overcome this? I'm using the latest 7.4 driver too. > I suspect it's an issue with the driver. 20k sounds high for batch updates. The driver has to keep the batched statements in memory until executeBatch(). Lowering the batch size may help. I find that, over a 100mb network, there's little-to-no benefit from batch sizes above 100 (@ 1k data per insert), even when the driver is really doing batching (which the current driver doesn't do). If you don't mind trying a very-experimental driver I have a version with substantial improvements to bytea support & batch updates waiting in the wings. I've seen a 5-fold speedup (and drastic reduction in memory use) of a microbenchmark that does batch inserts of bytea data. Let me know if you'd like to try that driver. (I'm looking for testers if any other adventurous people want to try it out..) -O