Re: Out of memory/corrupted shared memory problem on server

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Out of memory/corrupted shared memory problem on server
Date: 2017-08-25 10:48:20
Message-ID: 20170825104820.heszdtjsalb2xlom@squirrel.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

## Johann Spies (johann(dot)spies(at)gmail(dot)com):

> ------------------
> 2017-08-24 19:23:26 SAST [7532-18] LOG: server process (PID 4890) was
> terminated by signal 9: Killed

That looks like out-of-memory. Check the kernel log/dmesg to verify.

If it's the dreaded OOM-killer, you should check your overcommit
settings (sysctl vm.overcommit_*) and fix them in a way that
the kernel isn't forced to kill processes (that is, reduce overcommit).

Finally, in some cases it has been helpful to reduce work_mem -
that way PostgreSQL may be skewed away from memory intensive
operations (at the cost of processing time and/or disk IO - but
that's still better than having processes killed and getting no
result at all).
You could check the query plan for the query behind your view
(EXPLAIN) for potentially memory hungry operations.

> max_worker_processes = 24 # (change requires restart)
> max_parallel_workers_per_gather = 4 # taken from max_worker_processes

In case the query updating the materialized view uses parallel
processing, you could save quite some memory by turning that off
(more processes -> more memory usage -> not helpful in your case).

> # (for 60GB)
> kernel.shmall = 15728640
> kernel.shmmax = 64424509440

This is obsolete since PostgreSQL 9.3 ("Greatly reduce System V shared
memory requirements" says the Release Notes).

Regards,
Christoph

--
Spare Space.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-08-25 11:48:03 Re: Out of memory/corrupted shared memory problem on server
Previous Message Johann Spies 2017-08-25 08:29:30 Out of memory/corrupted shared memory problem on server