pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Johannes Truschnigg <johannes@truschnigg.info>
To: Jean-Christophe Boggio <postgresql@thefreecat.org>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: One PG process eating more than 40GB of RAM and getting killed by OOM
Date: Fri, 13 Oct 2023 15:13:28 +0200
Message-ID: <ZSlCeD80ThhvWp8a@vault.lan> (raw)
In-Reply-To: <1018f9c0-9d14-4146-b7e9-24c48ea29e1d@thefreecat.org>
References: <1018f9c0-9d14-4146-b7e9-24c48ea29e1d@thefreecat.org>

You will want to try decreasing work_mem to a sane number first, without
looking at anything else really.

Check out the official docs:
https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM

The gist is that work_mem is not a limit that's effective per
session/connection/query, but per sort- or hash-node, of which there can be
many in complex queries. Which is why 1GB of work_mem can end up consuming
several multiples of that, if you are (un)lucky enough.

-- 
with best regards:
- Johannes Truschnigg ( johannes@truschnigg.info )

www:   https://johannes.truschnigg.info/
phone: +436502133337
xmpp:  johannes@truschnigg.info

Attachments:

  [application/pgp-signature] signature.asc (832B, ../ZSlCeD80ThhvWp8a@vault.lan/2-signature.asc)
  download

view thread (11+ messages)  latest in thread

Message-ID: <ZSlCeD80ThhvWp8a@vault.lan>
Permalink:  ../ZSlCeD80ThhvWp8a@vault.lan/
Also on:    postgresql.org/message-id/ZSlCeD80ThhvWp8a@vault.lan

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: johannes@truschnigg.info, postgresql@thefreecat.org, pgsql-admin@lists.postgresql.org
  Subject: Re: One PG process eating more than 40GB of RAM and getting killed by OOM
  In-Reply-To: <ZSlCeD80ThhvWp8a@vault.lan>

* 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