Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRwae-0003XM-7a for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Feb 2023 14:47:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pRwac-0007De-QZ for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Feb 2023 14:47:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRwac-0007DT-IB for pgsql-bugs@lists.postgresql.org; Tue, 14 Feb 2023 14:47:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRwaa-0000Bn-5P for pgsql-bugs@lists.postgresql.org; Tue, 14 Feb 2023 14:47:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 31EElKex1682146; Tue, 14 Feb 2023 09:47:20 -0500 From: Tom Lane To: Francisco Olarte cc: tom@quist.de, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17793: Query with large number of joins crashes PostgreSQL In-reply-to: References: <17793-21fa598adbc21118@postgresql.org> Comments: In-reply-to Francisco Olarte message dated "Tue, 14 Feb 2023 12:51:02 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1682144.1676386040.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 14 Feb 2023 09:47:20 -0500 Message-ID: <1682145.1676386040@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Francisco Olarte writes: > On Tue, 14 Feb 2023 at 11:29, PG Bug reporting form > wrote: >> It looks like the OS is killing the process due to running OOM, which i= s not >> very surprising when looking at the query. Is this expected, or should = PG >> have guards in place to prevent this from happening? > When you run postgres in an environment where someone ( OOM killer ) > can K9 it, protection is hard. IIRC OOM can kill you because ANOTHER > process touches memory, among other things. Yeah. We have no visibility into what the OOM killer will choose to allow or not allow at any instant. > ( I do run DBs in machines w/ overcommit disabled, this prevents it > from happening, but it is not Pg who prevents it ). If overcommit-disabled doesn't seem practical, another idea that's been recommended is to start the postmaster under a "ulimit -v" setting chosen to cause plain ENOMEM failures before the OOM killer kicks in. regards, tom lane