Re: "out of memory" error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christian Schröder <cs(at)deriva(dot)de>
Cc: depesz(at)depesz(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: "out of memory" error
Date: 2007-08-23 06:13:51
Message-ID: 18161.1187849631@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?B?Q2hyaXN0aWFuIFNjaHLDtmRlcg==?= <cs(at)deriva(dot)de> writes:
> hubert depesz lubaczewski wrote:
>> On Wed, Aug 22, 2007 at 07:07:20PM +0200, Christian Schrder wrote:
>>> These are the current settings from the server configuration:
>>> shared_buffers = 3GB
>>
>> this is *way* to much. i would suggest lowering it to 1gig *at most*.
>>
> Ok, I can do this, but why can more memory be harmful?

Because you've left no room for anything else? The kernel, the various
other daemons, the Postgres code itself, and the local memory for each
Postgres process all require more than zero space.

Even more to the point, with such a large shared-buffer space, the
kernel probably will be tempted to swap out whatever parts of it seem
less used at the moment. That is far more harmful to performance than
not having had the buffer in the first place --- it can easily triple
the amount of disk I/O involved. (Thought experiment: dirty buffer is
written to disk, versus dirty buffer is swapped out to disk, then later
has to be swapped in so it can be written to wherever it should have
gone.)

Bottom line is that PG shared buffers are not so important as to deserve
3/4ths of your RAM.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick 2007-08-23 07:49:23 Re: CPU load high
Previous Message Christian Schröder 2007-08-23 05:54:20 Re: "out of memory" error