Re: DB Getting Slower and Slower and Slower.... - Mailing list pgsql-general

From Doug McNaught
Subject Re: DB Getting Slower and Slower and Slower....
Date
Msg-id m3g0eliw6d.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to DB Getting Slower and Slower and Slower....  ("Othman Laraki" <othman@epitrope.com>)
Responses RE: DB Getting Slower and Slower and Slower....  ("Othman Laraki" <othman@epitrope.com>)
List pgsql-general
"Othman Laraki" <othman@epitrope.com> writes:

> I recently upgraded to V7.1 version of Postgres on Linux and have
> noticed that as the DB is being used, it gets progressively slower
> and slower, until very simple queries slow down to a crawl.

First question: are you VACUUMing enough?  How active is the DB with
respect to inserts/updates?  You should be doing VACUUM ANALYZE at
least nightly (some people with very busy databases do it every couple
hours).

>                                                             The
> basic setup I have is a set of JSPs and Servlets running on Tomcat,
> that use Java classes which connect to Postgres through a JDBC
> driver and perform various DB operations. But, as I said, the DB
> gets noticeably slower, as if it does not clean up behind itself
> after performing operations and finally runs out of memory... Then,
> the only thing that works is stopping the postmaster and rebooting
> the machine.

Very odd.  You certainly shouldn't have to reboot to reclaim memory;
restarting the postmaster should be enough.

Are you sure the Java app or some other process isn't eating up all
the memory?  I was getting PG backend crashes due to lack of memory
every few days for a while, and finally found that it was my
webserver that was running away with itself...

Also make sure you're using the latest JDBC driver (early 7.1 RPMs had
one that was out of date).

Are you doing connection pooling in your web app?  Or does each
servlet/JSP connect and disconnect on its own?

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan

pgsql-general by date:

Previous
From: "Othman Laraki"
Date:
Subject: RE: DB Getting Slower and Slower and Slower....
Next
From: will trillich
Date:
Subject: Re: a primer on trigger?