Skip site navigation (1) Skip section navigation (2)

Re: OutOfMemory hibernate scroll with 2M records | Postgresql 8.4 DB

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Ankit Kumar <ankitk(at)xebia(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: OutOfMemory hibernate scroll with 2M records | Postgresql 8.4 DB
Date: 2009-12-21 13:50:35
Message-ID: 407d949e0912210550x39425bc6r2874ea4ad8400211@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Mon, Dec 21, 2009 at 12:54 PM, Ankit Kumar <ankitk(at)xebia(dot)com> wrote:
> I am running a Criteria.scroll() on postgresql on a DB containing 2M
> records. The memory keeps increasing and finally it generates an
> OutOfMemoryException. Please can you advice how to fix this.
>
> Postgresql DB version: 8.4
> Postgresql Driver Used: postgresql-8.4-701.jdbc4.jar
>
> Some forums do mention that "scroll" is slow on Postgresql.
>
> Is this a known issue or we need to do something specific to make scroll
> work on Postgresql?
>
>
> Exception StackTrace:
> java.lang.OutOfMemoryError: Java heap space
>

This looks like a Java error, not a Postgres one. It looks like
Hibernate is asking for the entire result set back from Postgres
instead of using a scrollable cursor and is trying to hold it all in
RAM. You should ask the Hibernate people if they plan to either spill
to disk or use database-side cursors which certainly do if necessary.

-- 
greg

In response to

Responses

pgsql-bugs by date

Next:From: Greg StarkDate: 2009-12-21 13:54:02
Subject: Re: BUG #5251: compilation fails in 32-bit mode
Previous:From: Devrim GÜNDÜZDate: 2009-12-21 13:41:33
Subject: Re: BUG #5252: postgresql-8.3.5.tar.gz does not exist any more

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group