pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedLarge selects
4+ messages / 3 participants
[nested] [flat]
* Large selects
@ 2006-08-24 08:26 Bendik Rognlien Johansen <bensmailinglists@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Bendik Rognlien Johansen @ 2006-08-24 08:26 UTC (permalink / raw)
To: pgsql-jdbc
Hello!
We are having a lot of trouble trying to use JDBC with PostgreSQL.
This is what we want to achieve:
- Select all rows in a table (people)
- Select addresses belonging to each person. By subselect or join
(addresses)
- Select phone numbers belonging to each person. By subselect or join
(contacts)
- Loop through the results, building a Lucene index.
Our tables:
- people: ~ 8 million records (could be larger in the future, maybe
50 million)
- addresses ~8 million records
- contacts: ~10 million records
Hardware:
2x dual core 3GHz intel Xeon
1-2 Gb RAM
Problem:
It seems that the PostgreSQL driver fetches the whole result, storing
it in memory, causing Java to run out of memory.
java.lang.OutOfMemoryError
We have tried increasing memory for the program (-Xmn100M -Xms512M -
Xmx512M), but we only have one gigabyte of memory to work with.
Does anyone have any suggestions on how to deal with this, other that
throwing more hardware at the problem? Cursors?
Any help is much appreciated!
Thanks
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Large selects
@ 2006-08-24 08:30 Roland Walter <rwa@mosaic-ag.com>
parent: Bendik Rognlien Johansen <bensmailinglists@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Roland Walter @ 2006-08-24 08:30 UTC (permalink / raw)
To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc
Bendik Rognlien Johansen schrieb:
> Hello!
>
> We are having a lot of trouble trying to use JDBC with PostgreSQL.
>
> This is what we want to achieve:
>
> - Select all rows in a table (people)
> - Select addresses belonging to each person. By subselect or join
> (addresses)
> - Select phone numbers belonging to each person. By subselect or join
> (contacts)
> - Loop through the results, building a Lucene index.
>
>
> Our tables:
> - people: ~ 8 million records (could be larger in the future, maybe 50
> million)
> - addresses ~8 million records
> - contacts: ~10 million records
>
>
> Hardware:
> 2x dual core 3GHz intel Xeon
> 1-2 Gb RAM
>
>
>
> Problem:
>
> It seems that the PostgreSQL driver fetches the whole result, storing
> it in memory, causing Java to run out of
> memory. java.lang.OutOfMemoryError
> We have tried increasing memory for the program (-Xmn100M -Xms512M
> -Xmx512M), but we only have one gigabyte of memory to work with.
>
> Does anyone have any suggestions on how to deal with this, other that
> throwing more hardware at the problem? Cursors?
>
>
> Any help is much appreciated!
> Thanks
>
Look here:
http://archives.postgresql.org/pgsql-jdbc/2006-01/msg00004.php
--
Roland Walter mailto: rwa (at) mosaic-ag (dot) com
MOSAIC SOFTWARE AG phone: +49 (0) 22 25 / 88 2-44 9
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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Large selects
@ 2006-08-24 08:38 Koth, Christian (DWBI) <Christian.Koth@smiths-heimann.com>
0 siblings, 0 replies; 4+ messages in thread
From: Koth, Christian (DWBI) @ 2006-08-24 08:38 UTC (permalink / raw)
To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc
Bendik,
- Loop through the results, building a Lucene index.
I guess you are trying to search within the contact data and therefore using lucene? Why not using the database build in possibilities for searching using SQL?
- Does anyone have any suggestions on how to deal with this, other that throwing more hardware at the problem? Cursors?
We are using cursors to access large result sets which works quite well. Also with postgres JDBC you can use scrollable result sets (only forward scrolling) and a limited fetch size.
Christian
******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.
******************************************
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Large selects
@ 2006-08-24 14:52 Bendik Rognlien Johansen <bensmailinglists@gmail.com>
parent: Roland Walter <rwa@mosaic-ag.com>
0 siblings, 0 replies; 4+ messages in thread
From: Bendik Rognlien Johansen @ 2006-08-24 14:52 UTC (permalink / raw)
To: pgsql-jdbc
Thank you both!
I will have a closer look tomorrow.
On Aug 24, 2006, at 10:38 AM, Koth, Christian (DWBI) wrote:
>
> Bendik,
>
> - Loop through the results, building a Lucene index.
>
> I guess you are trying to search within the contact data and
> therefore using lucene? Why not using the database build in
> possibilities for searching using SQL?
>
>
> - Does anyone have any suggestions on how to deal with this, other
> that throwing more hardware at the problem? Cursors?
>
> We are using cursors to access large result sets which works quite
> well. Also with postgres JDBC you can use scrollable result sets
> (only forward scrolling) and a limited fetch size.
>
> Christian
>
On Aug 24, 2006, at 10:30 AM, Roland Walter wrote:
> Bendik Rognlien Johansen schrieb:
>> Hello!
>>
>> We are having a lot of trouble trying to use JDBC with PostgreSQL.
>>
>> This is what we want to achieve:
>>
>> - Select all rows in a table (people)
>> - Select addresses belonging to each person. By subselect or join
>> (addresses)
>> - Select phone numbers belonging to each person. By subselect or
>> join (contacts)
>> - Loop through the results, building a Lucene index.
>>
>>
>> Our tables:
>> - people: ~ 8 million records (could be larger in the future,
>> maybe 50 million)
>> - addresses ~8 million records
>> - contacts: ~10 million records
>>
>>
>> Hardware:
>> 2x dual core 3GHz intel Xeon
>> 1-2 Gb RAM
>>
>>
>>
>> Problem:
>>
>> It seems that the PostgreSQL driver fetches the whole result,
>> storing it in memory, causing Java to run out of memory.
>> java.lang.OutOfMemoryError
>> We have tried increasing memory for the program (-Xmn100M -Xms512M
>> -Xmx512M), but we only have one gigabyte of memory to work with.
>>
>> Does anyone have any suggestions on how to deal with this, other
>> that throwing more hardware at the problem? Cursors?
>>
>>
>> Any help is much appreciated!
>> Thanks
>>
> Look here:
>
> http://archives.postgresql.org/pgsql-jdbc/2006-01/msg00004.php
>
> --
> Roland Walter mailto: rwa (at) mosaic-ag (dot) com
> MOSAIC SOFTWARE AG phone: +49 (0) 22 25 / 88 2-44 9
> 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.
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-08-24 14:52 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-24 08:26 Large selects Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-08-24 08:30 ` Roland Walter <rwa@mosaic-ag.com>
2006-08-24 14:52 ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-08-24 08:38 Re: Large selects Koth, Christian (DWBI) <Christian.Koth@smiths-heimann.com>
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