Re: Using a lot of memory in each session.

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: DBA <ecountdba(at)ecounterp(dot)co(dot)kr>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Using a lot of memory in each session.
Date: 2024-09-24 15:45:14
Message-ID: 5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2024-09-24 16:13:05 Re: Using a lot of memory in each session.
Previous Message Christophe Pettus 2024-09-24 15:22:32 Re: vacuumdb: permission denied for schema "pg_temp_7"