Skip to content

Commit 4fb505d

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 841ea92 commit 4fb505d

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
@@ -1258,9 +1258,10 @@ default:\
12581258
In Linux 2.4 and later, the default virtual memory behavior is not
12591259
optimal for <productname>PostgreSQL</productname>. Because of the
12601260
way that the kernel implements memory overcommit, the kernel might
1261-
terminate the <productname>PostgreSQL</productname> server (the
1262-
master server process) if the memory demands of
1263-
another process cause the system to run out of virtual memory.
1261+
terminate the <productname>PostgreSQL</productname> postmaster (the
1262+
master server process) if the memory demands of either
1263+
<productname>PostgreSQL</productname> or another process cause the
1264+
system to run out of virtual memory.
12641265
</para>
12651266

12661267
<para>
@@ -1287,6 +1288,19 @@ Out of Memory: Killed process 12345 (postgres).
12871288
swap space are exhausted.
12881289
</para>
12891290

1291+
<para>
1292+
If <productname>PostgreSQL</productname> itself is the cause of the
1293+
system running out of memory, you can avoid the problem by changing
1294+
your configuration. In some cases, it may help to lower memory-related
1295+
configuration parameters, particularly
1296+
<link linkend="guc-shared-buffers"><varname>shared_buffers</></link>
1297+
and <link linkend="guc-work-mem"><varname>work_mem</></link>. In
1298+
other cases, the problem may be caused by allowing too many connections
1299+
to the database server itself. In many cases, it may be better to reduce
1300+
<link linkend="guc-max-connections"><varname>max_connections</></link>
1301+
and instead make use of external connection-pooling software.
1302+
</para>
1303+
12901304
<para>
12911305
On Linux 2.6 and later, it is possible to modify the
12921306
kernel's behavior so that it will not <quote>overcommit</> memory.

0 commit comments

Comments
 (0)