Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2CPs-00EYru-8X for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Apr 2025 17:07:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u2CPq-00CTwf-JJ for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Apr 2025 17:07:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2CPq-00CTvF-9T for pgsql-hackers@lists.postgresql.org; Tue, 08 Apr 2025 17:07:14 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u2CPo-003iRF-2o for pgsql-hackers@lists.postgresql.org; Tue, 08 Apr 2025 17:07:13 +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 538H79494050388; Tue, 8 Apr 2025 13:07:09 -0400 From: Tom Lane To: Nathan Bossart cc: Hannu Krosing , PostgreSQL Hackers Subject: Re: Horribly slow pg_upgrade performance with many Large Objects In-reply-to: References: <4044567.1744128814@sss.pgh.pa.us> <4047312.1744130263@sss.pgh.pa.us> Comments: In-reply-to Nathan Bossart message dated "Tue, 08 Apr 2025 11:50:01 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4050386.1744132029.1@sss.pgh.pa.us> Date: Tue, 08 Apr 2025 13:07:09 -0400 Message-ID: <4050387.1744132029@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > I do think it's worth considering going back to copying > pg_largobject_metadata's files for upgrades from v16 and newer. (If we do this) I don't see why we'd need to stop at v16. I'm envisioning that we'd use COPY, which will be dealing in the text representation of aclitems, and I don't think that's changed in a long time. The sort of thing that would break it is changes in the set of available/default privilege bits for large objects. That is, where the dump currently contains something like SELECT pg_catalog.lo_create('2121'); ALTER LARGE OBJECT 2121 OWNER TO postgres; GRANT ALL ON LARGE OBJECT 2121 TO joe; we'd have COPY pg_largeobject_metadata FROM STDIN; ... 2121 10 {postgres=rw/postgres,joe=rw/postgres} ... and some appropriate COPY data for pg_shdepend too. (The fact that this representation will contain both numeric and symbolic role OIDs is why I was concerned about OID stability.) The key thing that worries me here is if the source and target versions have different ideas of which roles are pinned, which would silently change what appears in pg_shdepend. But it'd only really break if a role mentioned in some LO's owner or ACL is pinned in the source and not in the target, which seems unlikely. (In the other direction, we'd just be adding a useless row in pg_shdepend.) regards, tom lane