Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lucas Fairchild-Madar <lucas(dot)madar(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document
Date: 2017-10-06 20:13:22
Message-ID: 5827.1507320802@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Lucas Fairchild-Madar <lucas(dot)madar(at)gmail(dot)com> writes:
> Is there any sort of setting right now that can defend against this? A way
> to prevent a query from using 20+GB of memory? I'd prefer the query fail
> before the database system is kill -9'd.

You could experiment with running the postmaster under a ulimit setting,
but the more traditional recommendation is to disable OOM kill, cf

https://www.postgresql.org/docs/current/static/kernel-resources.html#linux-memory-overcommit

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-10-06 21:29:02 Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
Previous Message Lucas Fairchild-Madar 2017-10-06 20:03:52 Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document