Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C3400633138 for ; Mon, 22 Jun 2009 03:41:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70903-02 for ; Mon, 22 Jun 2009 03:41:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 933EC6330A8 for ; Mon, 22 Jun 2009 03:41:21 -0300 (ADT) Received: from [10.0.0.5] (tillium.localnet [10.0.0.5]) by mail.postnewspapers.com.au (Postfix) with ESMTP id C96181E0441; Mon, 22 Jun 2009 14:41:15 +0800 (WST) Subject: Re: Queries very slow and memory consumption too high From: Craig Ringer To: Saurabh Dave Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: Content-Type: text/plain Date: Mon, 22 Jun 2009 14:41:15 +0800 Message-Id: <1245652875.14499.7.camel@tillium.localnet> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/80 X-Sequence-Number: 19744 On Mon, 2009-06-22 at 10:32 +0530, Saurabh Dave wrote: > Hi, > > I am using Postgres 8.2.10 + Hibernate + c3p0 connection pooling. > For our application we support MySQL + Oracle + MSSQL + Postgres. > > 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. > > Please let me know what could be the issue. I am new to Postgres, so > any help would be greatly appreciated. You might want to provide some basic information, like: - What platform / OS / version your PostgreSQL server runs on. Eg "Ubuntu 9.04" or "Windows 2003 server". - The hardware specs of your server, including CPU, memory, and most importantly disks. "2Ghz" isn't good enough; a good description would be something like "SomeOem 2200GX - two 2.4GHz Xeon E4420s, 16GB RAM, 3Ware 9550/16 SATA disk controller with battery backup, write cache enabled, attached to 8 250GB 10,000rpm SATA HDDs in RAID 5 and 4 1TB HDDs in RAID 10." - Where on the server's disks your PostgreSQL data is. For example, you might say "WAL on 4x1TB RAID 10, main DB on 8x250GB RAID 5, pg_temp and sort tempfiles on single 8GB SATA RAM drive". If all your postgresql data is in one place, just mention how it's stored - the file system type, the RAID level, etc. - How much memory does your server have free when it slows down? On UNIX/Linux use "top" and "vmstat" to find this out. On Windows, this depends on OS version, but the process manager / task manager / performance monitor should tell you. - Is your server doing lots of disk I/O when it's slow? (unix/linux: seem vmstat. Windows Vista, see performance monitor. Others: nfi) - Is your server paging to disk when it's busy? (unix/linux: see vmstat. Windows: see task manager/process manager/performance monitor) -- Craig Ringer