how to limit statement memory allocation

From: Radoslav Nedyalkov <rnedyalkov(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: how to limit statement memory allocation
Date: 2021-03-09 15:35:35
Message-ID: CANhtRiabb+qeeRp--iBMrzWEJWJQoOOqS2-JaKA-3PY7CULXuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Occasionally we get bad queries on our db that consume a lot of memory.
These typically are full joins by mistake or just too large result sets.
My understanding is these should go to a temp file but apparently memory
allocation is preferred.
Last time a statement hit 150GB RAM and did not get a cancel or terminate
signal, so we had to
restart the db after a few hours, after another one popped up.

The only relevant , i guess, settings on the server are:
huge_pages = 'on'
shared_buffers = 196GB
work_mem = 1GB
maintenance_work_mem = 4GB
effective_cache_size = 720GB

Thank you in advance,
Rado

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-03-09 16:03:40 Re: how to limit statement memory allocation
Previous Message Alexander Farber 2021-03-09 14:49:36 Re: Stored function RETURNS table, but in some cases columns are missing - should I set them to NULL?