Re: Slow in morning hours

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: vathakar(at)banas(dot)guj(dot)nic(dot)in
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow in morning hours
Date: 2004-02-20 13:48:54
Message-ID: 40361046.9050708@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

vathakar(at)banas(dot)guj(dot)nic(dot)in wrote:
> Hi All,
>
> I am using Linux 7.2 and postgresql 7.2.
>
> Our Office hours are over at 6pm but we use to keep our server
> running 24 hours a day. On the second day morning, Our PGSQL
> Server becomes very slow.
>
> After continuous usage of one hour, It gradually starts responding
> faster ! This has become every day routine !
>
> do u have any idea related to this !!!! Is there any other reason that I
> need to check up?
>
> Please any any idea to get relief daily morning problem !!

I've seen this happen, and not just with PostgreSQL. The reasons are many
an varied, but here's my experience on the most common.

1) As someone else suggested, there may be some daily maintenance process
(i.e. backup) that's still running when you come in. Check this, and
reschedule if necessary.

2) Even if these nightly maintenance processes are finished when you first
come in, they've probably completely rearranged the contents of RAM.
Meaning, data that Linux had cached that made Postgres fast now needs
to be fetched from disk again. There are some things you can do, such
as adding RAM or getting faster disks, but this is a difficult problem
to solve. Some of the nightly processes could be safely disabled,
possibly, such as rebuilding the located database (if you don't use
locate) Possibly (I'm guessing here) if you scheduled pg_dump to be
the last process to run at night, it might put the cache back in a
better state?

3) First thing AM load. It's quite common for load to be higher at certain
times of the day, and first thing in the morning is a common time for
load to be higher than usual (especially for email servers). Check the
load on the machine with tools like top and see if it isn't just busier
in the morning than other times during the day. There might even be one
or two particular queries that people only run first thing that bog the
machine down. Depending on what you find, you may be able to optomise
some queries. Possibly some fine-tuning could correct the problem. Or
you might be forced to upgrade hardware if you want the machine to handle
the higher morning load faster. First thing to determine, though, is
whether or not the load is higher or the same.

Without more detail on the load, setting, etc of your system, these are all
guesses. Hopefully the information is helpful, though.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Neil Conway 2004-02-20 14:34:31 Re: Slow response of PostgreSQL
Previous Message Andrew Sullivan 2004-02-20 12:19:45 Re: Slow in morning hours