Re: cache whole data in RAM

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: David Teran <david(dot)teran(at)cluster9(dot)com>
Cc: PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: cache whole data in RAM
Date: 2004-02-03 13:27:39
Message-ID: 20040203132739.GA1468@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Feb 03, 2004 at 13:54:17 +0100,
David Teran <david(dot)teran(at)cluster9(dot)com> 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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Chris Trawick 2004-02-03 13:32:07 Re: cache whole data in RAM
Previous Message Shridhar Daithankar 2004-02-03 13:26:06 Re: cache whole data in RAM