pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: mark <pgroad@163.com>
To: pgsql-general@postgresql.org
Subject: Re: postgresql 9.5 has ocuuered OOM
Date: Wed, 20 Dec 2017 17:24:35 +0100
Message-ID: <74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com> (raw)
In-Reply-To: <2fd6f5eb.10a25.160747856ec.Coremail.pgroad@163.com>
References: <2fd6f5eb.10a25.160747856ec.Coremail.pgroad@163.com>

On 12/20/2017 04:08 PM, mark wrote:
> I have set shared_buffers is 1/4 of memory.
> work_mem is 2% of memory.
> max_connections is 50.

That means if you have all 50 connections active, they may easily
consume 100% of memory, because 50 * 2 is 100. It's even easier if the
connections are executing complex queries, because each query may use
multiple work_mem buffers. So 2% seems a bit too high.

> momery size is 16GB.
> postgresql process used over 70% of memory and occuered OOM.

So, did a single process use 70% of memory, or all postgres processes
combined?

If just a single process, it might be a poor plan choice (e.g. hash
aggregate may easily cause that).

If all processes combined, then perhaps it's due to work_mem being too high.

> what should I do to deal with this problem?
> 

Hard to say, until you provide enough information.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (9+ messages)  latest in thread

Message-ID: <74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com>
Permalink:  ../74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com/
Also on:    postgresql.org/message-id/74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, pgroad@163.com
  Subject: Re: postgresql 9.5 has ocuuered OOM
  In-Reply-To: <74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com>
  References: <2fd6f5eb.10a25.160747856ec.Coremail.pgroad@163.com> <74cbd04b-88b6-f991-e253-7805e3ac7128@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox