Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0Z0g-00068V-1w for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Oct 2017 20:14:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e0Z0f-0004t8-EX for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Oct 2017 20:14:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e0Yzw-0003bG-VO for pgsql-bugs@postgresql.org; Fri, 06 Oct 2017 20:13:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e0Yzt-0006fa-AX for pgsql-bugs@postgresql.org; Fri, 06 Oct 2017 20:13:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v96KDNGK005828; Fri, 6 Oct 2017 16:13:23 -0400 From: Tom Lane To: Lucas Fairchild-Madar cc: pgsql-bugs@postgresql.org Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document In-reply-to: References: <1546.1507314635@sss.pgh.pa.us> <2376.1507315734@sss.pgh.pa.us> <4514.1507318623@sss.pgh.pa.us> Comments: In-reply-to Lucas Fairchild-Madar message dated "Fri, 06 Oct 2017 13:03:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5826.1507320802.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 06 Oct 2017 16:13:22 -0400 Message-ID: <5827.1507320802@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Lucas Fairchild-Madar 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 --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs