Re: "out of memory" error - Mailing list pgsql-general

From Tom Lane
Subject Re: "out of memory" error
Date
Msg-id 18161.1187849631@sss.pgh.pa.us
Whole thread Raw
In response to Re: "out of memory" error  (Christian Schröder <cs@deriva.de>)
Responses Re: "out of memory" error  (Christian Schröder <cs@deriva.de>)
List pgsql-general
=?UTF-8?B?Q2hyaXN0aWFuIFNjaHLDtmRlcg==?= <cs@deriva.de> writes:
> hubert depesz lubaczewski wrote:
>> On Wed, Aug 22, 2007 at 07:07:20PM +0200, Christian Schröder 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

pgsql-general by date:

Previous
From: Christian Schröder
Date:
Subject: Re: "out of memory" error
Next
From: "Patrick Lindeman"
Date:
Subject: Re: CPU load high