Re: out of memory using Postgres with Spring/Hibernate/Java

From: "chris smith" <dmagick(at)gmail(dot)com>
To: "maarten roosendaal" <mroosendaal(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: out of memory using Postgres with Spring/Hibernate/Java
Date: 2006-03-15 07:13:09
Message-ID: 3c1395330603142313o102d109ckde4891639bb5808d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/15/06, maarten roosendaal <mroosendaal(at)yahoo(dot)com> wrote:
> Hi,
>
> We are currently having a problem that our Postgres DB
> is throwing an SQL error which states that it's 'out
> of memory'.
>
> What we have is a DB with 1 table that has 3.9 million
> records. We need to find certain records that are to
> be processed by a Java App so we do a "select id from
> table where type=a and condition in (1, 2) order by id
> limit 2000". When this query gets executed we see the
> memory on the DB Server increasing and after it has
> finishes it drops a bit but we see it growing a few MB
> per few minutes. This has caused an out of memory
> after the system has been processing for a day or 2.
> The query is heavy because of the order by but that
> does not explain why the memory is increasing.

What does explain show for the query? Are the fields indexed
appropriately? Have you analyzed the table recently?

Postgres needs to store the ordered results somewhere so of course
that explains the memory increase.

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2006-03-15 08:24:16 Re: Error in Postgresql after a Machine Crash
Previous Message karly 2006-03-15 06:15:15 Dumping rows into an array?