Re: table full scan

From: "Khaldoun Ateyeh" <Khaldoun(dot)Ateyeh(at)panoratio(dot)de>
To: "Roland Walter" <rwa(at)mosaic-ag(dot)com>, <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: table full scan
Date: 2006-01-05 12:49:32
Message-ID: 0BD53BBFEDA6B240851F0B40DC7992E718081C@S007DCDE.panoratio.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

Which driver should I use? Because when I do what you suggested, I get
"This method is not yet implemented" ... stmt.setFetchSize(1000).

I am using the official postgresql-8.1-404.jdbc3.jar driver.

Many thanks.

Khaldoun

-----Original Message-----
From: Roland Walter [mailto:rwa(at)mosaic-ag(dot)com]
Sent: Thursday, January 05, 2006 1:15 PM
To: Khaldoun Ateyeh
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] table full scan

"Khaldoun Ateyeh" <Khaldoun(dot)Ateyeh(at)panoratio(dot)de> writes:

> Hi,
> I am using jdbc to full scan a huge table (over 11 million records).
> Unfortunately, I get an OutOfMemoryError exception. Is there any way
to
> tell postgre not to try to load the whole table at once?
>

Set autocommit to false, then use the method setFetchSize() of
the Statement to set the maximal rows that are read into the memory.

For example:

con.setAutoCommit(false);
stmt = con.createStatement();
stmt.setFetchSize(1000);
--
Roland Walter mailto: rwa (at) mosaic-ag (dot) com
MOSAIC SOFTWARE AG phone: +49 (0) 22 25 / 88 2-41 1
Am Pannacker 3 fax: +49 (0) 22 25 / 88 2-20 1
D-53340 Meckenheim http://www.mosaic-ag.com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2006-01-05 13:06:33 Re: table full scan
Previous Message hpb@htl-steyr.ac.at 2006-01-05 12:39:31 bug in getTime after insertRow with postgresql-8.1-404.jdbc3.jar