Skip to content

Commit 36bffe4

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 6403930 commit 36bffe4

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,9 @@ default:\
12691269
optimal for <productname>PostgreSQL</productname>. Because of the
12701270
way that the kernel implements memory overcommit, the kernel might
12711271
terminate the <productname>PostgreSQL</productname> postmaster (the
1272-
master server process) if the memory demands of
1273-
another process cause the system to run out of virtual memory.
1272+
master server process) if the memory demands of either
1273+
<productname>PostgreSQL</productname> or another process cause the
1274+
system to run out of virtual memory.
12741275
</para>
12751276

12761277
<para>
@@ -1297,6 +1298,19 @@ Out of Memory: Killed process 12345 (postgres).
12971298
swap space are exhausted.
12981299
</para>
12991300

1301+
<para>
1302+
If <productname>PostgreSQL</productname> itself is the cause of the
1303+
system running out of memory, you can avoid the problem by changing
1304+
your configuration. In some cases, it may help to lower memory-related
1305+
configuration parameters, particularly
1306+
<link linkend="guc-shared-buffers"><varname>shared_buffers</></link>
1307+
and <link linkend="guc-work-mem"><varname>work_mem</></link>. In
1308+
other cases, the problem may be caused by allowing too many connections
1309+
to the database server itself. In many cases, it may be better to reduce
1310+
<link linkend="guc-max-connections"><varname>max_connections</></link>
1311+
and instead make use of external connection-pooling software.
1312+
</para>
1313+
13001314
<para>
13011315
On Linux 2.6 and later, it is possible to modify the
13021316
kernel's behavior so that it will not <quote>overcommit</> memory.

0 commit comments

Comments
 (0)