pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: DBA <ecountdba@ecounterp.co.kr>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Using a lot of memory in each session.
Date: Tue, 24 Sep 2024 17:45:14 +0200
Message-ID: <5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at> (raw)
In-Reply-To: <20240924075811.BDA2C10AA13@wsmtpa1.ecounterp.com>
References: <20240924075811.BDA2C10AA13@wsmtpa1.ecounterp.com>

On Tue, 2024-09-24 at 16:58 +0900, DBA wrote:
> We set shared_buffer = 70GB, max_connections = 300, work_mem = 300MB.
> 
> We thought the session memory could be adjusted with the work_mem variable, but no.
> noticed that each session consumed more than 500MB.

work_mem limits the memory used by a single execution plan step, so a single
backend can use way more memory.
Moreover, there is hash_mem_multiplier, which defaults to 2 in v15, so a
hash may use twice as much memory.

You didn't tell us how much RAM you have, but your setting of shared_buffers
is probably too high, and you most likely should also reduce work_mem,
particularly if you allow hundreds of connections.

Anyway, I see no bug here.

Yours,
Laurenz Albe





view thread (3+ messages)  latest in thread

Message-ID: <5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at>
Permalink:  ../5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at/
Also on:    postgresql.org/message-id/5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at

 · 

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-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, ecountdba@ecounterp.co.kr, pgsql-bugs@lists.postgresql.org
  Subject: Re: Using a lot of memory in each session.
  In-Reply-To: <5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at>

* 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