Re: Using a lot of memory in each session. - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: Using a lot of memory in each session.
Date
Msg-id 5f727153d2593bcd0454d4897eb387da60c90c94.camel@cybertec.at
Whole thread Raw
List 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



pgsql-bugs by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: vacuumdb: permission denied for schema "pg_temp_7"
Next
From: Andres Freund
Date:
Subject: Re: Using a lot of memory in each session.