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 1lO4BR-0005gK-7H for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 19:56:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lO4BP-0007Ls-VY for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 19:56:19 +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 1lO4BP-0007Ll-Du for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 19:56:19 +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 1lO4BM-00005V-QB for pgsql-hackers@postgresql.org; Sun, 21 Mar 2021 19:56:17 +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 12LJuECD399568; Sun, 21 Mar 2021 15:56:14 -0400 From: Tom Lane To: Jan Wieck cc: Magnus Hagander , Robins Tharakan , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: Fix pg_upgrade to preserve datdba In-reply-to: References: <1742698.1615221182@sss.pgh.pa.us> <1743618.1615222719@sss.pgh.pa.us> <4fbf92f2-ec91-f4fa-a259-f0968e34f3d7@wi3ck.info> <0b5d506d-70d2-1506-bbdf-89e6453c0289@wi3ck.info> <384713.1616345832@sss.pgh.pa.us> <2284b71d-af55-2625-f8c2-cedf1f1a70ca@wi3ck.info> <388155.1616351018@sss.pgh.pa.us> <388710.1616351698@sss.pgh.pa.us> Comments: In-reply-to Jan Wieck message dated "Sun, 21 Mar 2021 15:36:51 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <399566.1616356574.1@sss.pgh.pa.us> Date: Sun, 21 Mar 2021 15:56:14 -0400 Message-ID: <399567.1616356574@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jan Wieck writes: > So let's focus on the actual problem of running out of XIDs and memory > while doing the upgrade involving millions of small large objects. Right. So as far as --single-transaction vs. --create goes, that's mostly a definitional problem. As long as the contents of a DB are restored in one transaction, it's not gonna matter if we eat one or two more XIDs while creating the DB itself. So we could either relax pg_restore's complaint, or invent a different switch that's named to acknowledge that it's not really only one transaction. That still leaves us with the lots-o-locks problem. However, once we've crossed the Rubicon of "it's not really only one transaction", you could imagine that the switch is "--fewer-transactions", and the idea is for pg_restore to commit after every (say) 100000 operations. That would both bound its lock requirements and greatly cut its XID consumption. The work you described sounded like it could fit into that paradigm, with the additional ability to run some parallel restore tasks that are each consuming a bounded number of locks. regards, tom lane