Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D765AB5DBC4 for ; Thu, 14 Jul 2011 15:26:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 69081-02 for ; Thu, 14 Jul 2011 18:25:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id F029BB5DBC1 for ; Thu, 14 Jul 2011 15:25:58 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 14 Jul 2011 13:25:56 -0500 Message-Id: <4E1EEE61020000250003F33F@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 14 Jul 2011 13:25:53 -0500 From: "Kevin Grittner" To: "Christoph Anton Mitterer" , Subject: Re: how to make PostgreSQL using "all" memory and chaching the DB completely there References: <1310642850.28621.37.camel@gar-ws-etp71.garching.physik.uni-muenchen.de> In-Reply-To: <1310642850.28621.37.camel@gar-ws-etp71.garching.physik.uni-muenchen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/104 X-Sequence-Number: 37883 >Christoph Anton Mitterer 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