X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 47C86D1D189 for ; Tue, 3 Feb 2004 13:26:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14848-06 for ; Tue, 3 Feb 2004 09:26:11 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id D59ABD1D12E for ; Tue, 3 Feb 2004 09:26:08 -0400 (AST) Received: (qmail 21804 invoked by uid 500); 3 Feb 2004 13:27:39 -0000 Date: Tue, 3 Feb 2004 07:27:39 -0600 From: Bruno Wolff III To: David Teran Cc: PgSQL Performance ML Subject: Re: cache whole data in RAM Message-ID: <20040203132739.GA1468@wolff.to> Mail-Followup-To: David Teran , PgSQL Performance ML References: <13E980A8-5648-11D8-BC99-000A95A6F0DC@cluster9.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13E980A8-5648-11D8-BC99-000A95A6F0DC@cluster9.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/35 X-Sequence-Number: 5559 On Tue, Feb 03, 2004 at 13:54:17 +0100, David Teran wrote: > Hi, > > we are trying to speed up a database which has about 3 GB of data. The > server has 8 GB RAM and we wonder how we can ensure that the whole DB > is read into RAM. We hope that this will speed up some queries. The OS should do this on its own. What you don't want to do is set shared_buffers (in postgresql.conf) too high. From what I remember from past discussions it should be something between about 1000 and 10000. sort_mem is trickier since that memory is per sort and a single query can potentially generate multiple parallel sorts. You will have to make some guesses for this based on what you think the number of concurrent sorts will be when the system is stressed and not use too much memory. You might also find that after a point you don't get a lot of benefit from increasing sort_mem. You should set effective_cache_size pretty large. Probably you want to subtract the space used by shared_buffers and sort_mem (* times estimated parallel sorts) and what you think is reasonable overhead for other processes from the 8GB of memory. Since your DB's disk blocks will almost certainly all be in buffer cache, you are going to want to set random_page_cost to be pretty close to 1.