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 1mE1aO-0008S7-5M for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 03:40:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mE1aL-0002iT-Ue for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 03:40:49 +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 1mE1aL-0002iL-Lv for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 03:40:49 +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 1mE1aG-000586-UJ for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 03:40:49 +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 17C3ecko4045763; Wed, 11 Aug 2021 23:40:38 -0400 From: Tom Lane To: Michael Harris cc: "'pgsql-general@lists.postgresql.org'" Subject: Re: ERROR: invalid memory alloc request size when committing transaction In-reply-to: References: Comments: In-reply-to Michael Harris message dated "Thu, 12 Aug 2021 01:06:55 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4045761.1628739638.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 11 Aug 2021 23:40:38 -0400 Message-ID: <4045762.1628739638@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Harris writes: > - Next we run a migration script on each database in the cluster. The = migration script > converts a large number of tables from inheritance based partitionin= g to declarative = > partitioning. Unfortunately I am not at liberty to share the migrati= on script. How many is "a large number"? > The migration is performed inside a transaction, and during the process = of committing the > transaction the following error is thrown: > [2021-08-11 11:27:50 CEST] aue_75@218006 218015@[local] db_vrqv1 ERROR: = invalid memory alloc request size 1073741824 > [2021-08-11 11:27:50 CEST] aue_75@218006 218015@[local] db_vrqv1 STATEME= NT: commit > [2021-08-11 11:27:50 CEST] aue_75@218006 218015@[local] db_vrqv1 WARNING= : AbortTransaction while in COMMIT state It's impossible to do more than speculate with this amount of information. However, a plausible speculation is that you're processing so many objects in one transaction as to overrun the limit on how large a WAL commit recor= d, or something related to that, can be. Can you adjust your migration script to break it into multiple transactions that process fewer tables per transaction? regards, tom lane