pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Queries very slow and memory consumption too high
Date: Mon, 22 Jun 2009 09:02:25 +0200
Message-ID: <h1naa0$2lk$1@ger.gmane.org> (raw)
In-Reply-To: <fdd0c0f90906212202s68a9e393u654420245e84df31@mail.gmail.com>
References: <fdd0c0f90906212202s68a9e393u654420245e84df31@mail.gmail.com>

Saurabh Dave, 22.06.2009 07:02:

> With all the other databases our application is working quite fine, but 
> with Postgres after a day queries are becoming extremely slow and it 
> seems to be taking up all the available memory.

It's not clear to me *where* the memory is taken. Is that on the machine running your application (i.e. Hibernate and the connection pool) or is that memory taken on the Postgres server?

If it's on the application server, could this be caused by not properly closed result sets? The Postgres JDBC driver by default buffers all ResultSets in memory before returning to the calling class. If you do not close your result sets properly, maybe this memory is not released by the driver.

As an alternative you might try to configure the connection to use "cursor based fetching" to avoid the buffering in the driver code:

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

Regards
Thomas




view thread (13+ messages)  latest in thread

Message-ID: <h1naa0$2lk$1@ger.gmane.org>
Permalink:  ../h1naa0$2lk$1@ger.gmane.org/
Also on:    postgresql.org/message-id/h1naa0$2lk$1@ger.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: Queries very slow and memory consumption too high
  In-Reply-To: <h1naa0$2lk$1@ger.gmane.org>
  References: <fdd0c0f90906212202s68a9e393u654420245e84df31@mail.gmail.com> <h1naa0$2lk$1@ger.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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