Re: how to make PostgreSQL using "all" memory and chaching the DB completely there

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Christoph Anton Mitterer" <christoph(dot)anton(dot)mitterer(at)physik(dot)uni-muenchen(dot)de>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: how to make PostgreSQL using "all" memory and chaching the DB completely there
Date: 2011-07-14 18:25:53
Message-ID: 4E1EEE61020000250003F33F@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>Christoph Anton Mitterer
<christoph(dot)anton(dot)mitterer(at)physik(dot)uni-muenchen(dot)de>
wrote:

> What we have here at the institute is a quite powerful server,
> whit about 100GB RAM that has a PostgreSQL running on it (with
> several DBs).

In one cluster (postmaster instance) or separate?

> Currently it's 8.4 but we shall switch to 9.x eventually. The
> database is (physical) size is currently at about 30 GB.

30 GB is the total of all the databases?

> What I'd like to have, is that Postgresql uses at MAX say 50%
> (~50GB) of the available memory.

The only way to do that is with OS limits, like ulimit. Of course,
if you set the shared_buffers well under that and use reasonable
settings for other parameters, it won't tend to go above that unless
the RAM is unused by any other process. If you really want to be
sure some amount of RAM is not used by *any* process, the best way
is to pull it out of the machine and set it on a shelf -- it will do
as much good there as sitting unused in a machine. ;-)

> And there it should completely cache the DB for _reading_.

If there's sufficient unused RAM on the machine, it will do this
automatically.

> When any writes occur, these should still be sent "immediately" to
> disk.

The writes are persisted on COMMIT (before the COMMIT statement
completes), unless you configure for unsafe values. Make sure that
fsync, full_page_writes, and synchronous_commit are all on.

Make sure you have a good RAID controller with battery-back-up
caching configured for write-back.

-Kevin

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message saravanan 2011-07-15 07:11:48 Re: Importing the dump file in postgresql-7.4.23
Previous Message Scott Marlowe 2011-07-14 17:04:06 Re: how to make PostgreSQL using "all" memory and chaching the DB completely there