Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 169F263331A for ; Mon, 22 Jun 2009 04:02:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 97564-02 for ; Mon, 22 Jun 2009 04:02:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id D7FFA632D87 for ; Mon, 22 Jun 2009 04:02:40 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MIdY4-0008NA-Hr for pgsql-jdbc@postgresql.org; Mon, 22 Jun 2009 07:02:36 +0000 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 Jun 2009 07:02:36 +0000 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 Jun 2009 07:02:36 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Queries very slow and memory consumption too high Date: Mon, 22 Jun 2009 09:02:25 +0200 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.599 tagged_above=0 required=5 tests=RCVD_IN_DNSWL_LOW=-1, RCVD_NUMERIC_HELO=2.599 X-Spam-Level: * X-Archive-Number: 200906/81 X-Sequence-Number: 19745 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