Large selects - Mailing list pgsql-jdbc

From Bendik Rognlien Johansen
Subject Large selects
Date
Msg-id 1DE86526-D22F-483E-BA4A-DAF1B85EDFCC@gmail.com
Whole thread Raw
Responses Re: Large selects  (Roland Walter <rwa@mosaic-ag.com>)
List 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




pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: org.postgresql.util.PSQLException: An I/O error occured
Next
From: Roland Walter
Date:
Subject: Re: Large selects