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

From Christian Schröder
Subject Re: "out of memory" error
Date
Msg-id 46CDD256.3030401@deriva.de
Whole thread Raw
In response to Re: "out of memory" error  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "out of memory" error  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Tom Lane wrote: <blockquote cite="mid:18161.1187849631@sss.pgh.pa.us" type="cite"><blockquote type="cite"><pre
wrap="">Ok,I can do this, but why can more memory be harmful?   </pre></blockquote><pre wrap=""> 
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. </pre></blockquote><br /> So does this mean that the stuff you
mentionedneeds more than 1 GB of memory? I seem to have undererstimated the amount of memory that is needed for these
purposes.:(<br /><br /><blockquote cite="mid:18161.1187849631@sss.pgh.pa.us" type="cite"><pre wrap=""> 
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. </pre></blockquote><br /> Thanks for your tips! I have changed the "shared_buffers" setting back to
2GB. It was set to 2 GB before, but we also had "out of memory" errors with this setting, so I raised it to 3 GB.<br />
Couldyou please help me understand what's happening? The server is a dedicated database server. Few other demons are
running,most of them are system services that do not consume a considerable amount of memory. No web server or similar
isrunning on this machine.<br /> Moreover, the output of "free" confuses me:<br /><br />     db2:~ # free -m<br />    
            total       used       free     shared    buffers     cached<br />     Mem:          3954       3724       
229         0          0       3097<br />     -/+ buffers/cache:        627       3326<br />     Swap:        
2055       628       1426<br /><br /> Doesn't that mean that plenty of memory is unused? I always thought that the
memoryused for buffers and caches can be thought of as free memory. Isn't this correct?<br /> Regarding the memory
needsof the PostgreSQL server itself: Is there any estimation how much memory will be needed besides the shared
buffers?What exactly does "out of memory" mean? Who requested the memory and why could this memory request not be
fulfilled?<br/> I can post the memory overview from the log file, but I don't know if it's considered impolite to post
somany lines to this mailing list.<br /><br /> Thanks a lot again for your help,<br />     Christian<br /><pre
class="moz-signature"cols="72">--  
Deriva GmbH                         Tel.: +49 551 489500-42
Financial IT and Consulting         Fax:  +49 551 489500-91
Hans-Böckler-Straße 2                  <a class="moz-txt-link-freetext"
href="http://www.deriva.de">http://www.deriva.de</a>
D-37079 Göttingen

Deriva CA Certificate: <a class="moz-txt-link-freetext"
href="http://www.deriva.de/deriva-ca.cer">http://www.deriva.de/deriva-ca.cer</a></pre>

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Argument type list
Next
From: "Joshua D. Drake"
Date:
Subject: Re: PostgreSQL vs Firebird feature comparison finished