Re: Postgres utils chewing RAM

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Lane <slane(at)fmpro(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres utils chewing RAM
Date: 2002-04-29 05:53:01
Message-ID: 18255.1020059581@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Lane <slane(at)fmpro(dot)com> writes:
> I seem to be having a problem with the postgres utilities chewing a lot of
> RAM. I've been running PG 7.1 under LinuxPPC on a PowerMac G4. After a few
> days of use, free memory degrades to almost nothing.

This is wrong?

On most Unixen, the kernel happily uses all spare RAM to cache
recently-accessed disk blocks. If you've got large amounts of "free"
RAM it only means that (a) you rebooted recently, or (b) you're not
doing much disk access.

> I logged memory usage
> for a while and found that free memory would suddenly drop by 200-300 meg
> every night at 1:20 AM, right when my nightly maintenance scripts run.

> I traced through the nightly scripts and found that two things seem to
> account for the memory loss -- vacuuming the databases, and backing them up.
> I restarted to free all my RAM back up and tried just those operations. Sure
> enough, after a vacuum verbose analyze (on about thirty tables totaling
> probably less than 50 MB of data), free memory dropped by 130MB. Backing up
> everything on the server took another 110MB. And this memory never gets
> returned.

This all sounds like standard, expected, preferable behavior.

As soon as you run programs that need RAM, the kernel will drop those
disk-cache pages and assign the RAM to program space. But as long as
you don't, what else should the kernel do with unused RAM than keep disk
cache in it?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2002-04-29 05:53:58 Re: Postgres utils chewing RAM
Previous Message postgres 2002-04-29 05:51:23 Re: Postgres utils chewing RAM