Skip to content

Commit f6956eb

Browse files
committed
Document how to prevent PostgreSQL itself from exhausting memory.
The existing documentation in Linux Memory Overcommit seemed to assume that PostgreSQL itself could never be the problem, or at least it didn't tell you what to do about it. Per discussion with Craig Ringer and Kevin Grittner.
1 parent 657face commit f6956eb

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,10 @@ default:\
13091309
In Linux 2.4 and later, the default virtual memory behavior is not
13101310
optimal for <productname>PostgreSQL</productname>. Because of the
13111311
way that the kernel implements memory overcommit, the kernel might
1312-
terminate the <productname>PostgreSQL</productname> server (the
1313-
master server process) if the memory demands of
1314-
another process cause the system to run out of virtual memory.
1312+
terminate the <productname>PostgreSQL</productname> postmaster (the
1313+
master server process) if the memory demands of either
1314+
<productname>PostgreSQL</productname> or another process cause the
1315+
system to run out of virtual memory.
13151316
</para>
13161317

13171318
<para>
@@ -1338,6 +1339,19 @@ Out of Memory: Killed process 12345 (postgres).
13381339
swap space are exhausted.
13391340
</para>
13401341

1342+
<para>
1343+
If <productname>PostgreSQL</productname> itself is the cause of the
1344+
system running out of memory, you can avoid the problem by changing
1345+
your configuration. In some cases, it may help to lower memory-related
1346+
configuration parameters, particularly
1347+
<link linkend="guc-shared-buffers"><varname>shared_buffers</></link>
1348+
and <link linkend="guc-work-mem"><varname>work_mem</></link>. In
1349+
other cases, the problem may be caused by allowing too many connections
1350+
to the database server itself. In many cases, it may be better to reduce
1351+
<link linkend="guc-max-connections"><varname>max_connections</></link>
1352+
and instead make use of external connection-pooling software.
1353+
</para>
1354+
13411355
<para>
13421356
On Linux 2.6 and later, it is possible to modify the
13431357
kernel's behavior so that it will not <quote>overcommit</> memory.

0 commit comments

Comments
 (0)