Re: table full scan

Lists: pgsql-jdbc
From: "Khaldoun Ateyeh" <Khaldoun(dot)Ateyeh(at)panoratio(dot)de>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: table full scan
Date: 2006-01-05 09:32:28
Message-ID: 0BD53BBFEDA6B240851F0B40DC7992E7180812@S007DCDE.panoratio.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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?

Best Regards.

Khaldoun


From: Kris Jurka <books(at)ejurka(dot)com>
To: Khaldoun Ateyeh <Khaldoun(dot)Ateyeh(at)panoratio(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: table full scan
Date: 2006-01-05 12:14:22
Message-ID: Pine.BSO.4.61.0601050713560.9579@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 5 Jan 2006, Khaldoun Ateyeh wrote:

> 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?
>

http://jdbc.postgresql.org/documentation/81/query.html#query-with-cursor

Kris Jurka


From: Roland Walter <rwa(at)mosaic-ag(dot)com>
To: "Khaldoun Ateyeh" <Khaldoun(dot)Ateyeh(at)panoratio(dot)de>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: table full scan
Date: 2006-01-05 12:15:17
Message-ID: rc43bk250ru.fsf@mosaic-ag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

"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

Die in dieser E-Mail enthaltenen Nachrichten und Anhaenge sind ausschliesslich
fuer den bezeichneten Adressaten bestimmt. Sie koennen rechtlich geschuetzte,
vertrauliche Informationen enthalten. Falls Sie nicht der bezeichnete Empfaenger
oder zum Empfang dieser E-Mail nicht berechtigt sind, ist die Verwendung,
Vervielfaeltigung oder Weitergabe von Nachrichten und Anhaengen untersagt.
Falls Sie diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte
unverzueglich den Absender und vernichten Sie die E-Mail.

This e-mail message and any attachment are intended exclusively for the named
addressee. They may contain confidential information which may also be protected
by professional secrecy. Unless you are the named addressee (or authorised to
receive for the addressee) you may not copy or use this message or any attachment
or disclose the contents to anyone else. If this e-mail was sent to you by mistake
please notify the sender immediately and delete this e-mail.