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 1nPnQy-0003bW-9C for pgsql-performance@arkaria.postgresql.org; Thu, 03 Mar 2022 15:32:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nPnQx-0001Ug-8d for pgsql-performance@arkaria.postgresql.org; Thu, 03 Mar 2022 15:32:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPnQw-0001US-VG for pgsql-performance@lists.postgresql.org; Thu, 03 Mar 2022 15:32:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPnQu-0004Rm-Mc for pgsql-performance@lists.postgresql.org; Thu, 03 Mar 2022 15:32:01 +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 223FVxI33161847; Thu, 3 Mar 2022 10:31:59 -0500 From: Tom Lane To: =?UTF-8?Q?Marc_Recht=c3=a9?= cc: pgsql-performance@lists.postgresql.org Subject: Re: OOM killer while pg_restore In-reply-to: <866ba95f-86fb-fa9b-ecee-65281160cff9@rechte.fr> References: <866ba95f-86fb-fa9b-ecee-65281160cff9@rechte.fr> Comments: In-reply-to =?UTF-8?Q?Marc_Recht=c3=a9?= message dated "Thu, 03 Mar 2022 09:59:03 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3161845.1646321519.1@sss.pgh.pa.us> Date: Thu, 03 Mar 2022 10:31:59 -0500 Message-ID: <3161846.1646321519@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?Q?Marc_Recht=c3=a9?= writes: > We have a pg_restore which fails due to RAM over-consumption of the > corresponding PG backend, which ends-up with OOM killer. > The table has one PK, one index, and 3 FK constraints, active while > restoring. > The dump contains over 200M rows for that table and is in custom format, > which corresponds to 37 GB of total relation size in the original DB. The FKs would result in queueing row trigger events, which would occupy some memory. But those should only need ~12 bytes per FK per row, which works out to less than 10GB for this number of rows, so it may be that you've hit something else that we would consider a leak. Does memory consumption hold steady if you drop the FK constraints? If not, as others have noted, we'd need more info to investigate this. The leak is probably independent of the specific data in the table, so maybe you could make a small self-contained example using a script to generate dummy data. regards, tom lane