model-writtenrun 7042 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Hannu Krosing opened the thread with roughly 100-minute restores for 100 million large objects and proposed copying their metadata files or using COPY instead of individual creation commands; his PostgreSQL 17 measurements showed metadata-only COPY restores taking about two minutes #1 #5.
- Nathan Bossart explained that the aclitem storage-format change restricted direct file copying to upgrades from PostgreSQL 16 onward, and Nathan and Tom Lane placed the proposed optimization beyond the PostgreSQL 18 feature freeze #3 #8 #10.
- Tom raised role-OID stability and missing pg_shdepend entries as correctness requirements; Hannu established that role OIDs were preserved, and Tom outlined copying both metadata and dependency rows while opposing a backpatch #10 #11 #12 #15.
- Nathan confirmed that database OIDs were also preserved and demonstrated that historical file-copy upgrades could lose large-object privilege dependencies, reinforcing the need to transfer pg_shdepend correctly #20 #23.
- Tom noticed that the database-OID guarantee was missing from pg_upgrade.c's opening comment, and Nathan's small documentation patch landed unchanged as e2665efd0f #22 #27.
- Nathan's experiments identified ALTER OWNER as a major restore cost, while Hannu showed additional GRANTs increasing both restore time and catalog bloat; batching creation commands looked promising but Nathan abandoned that implementation because of its complexity #29 #30 #31.
- Nathan submitted a COPY proof of concept that reduced his ten-million-object upgrade from about 8.5 minutes to one minute, initially transferring pg_shdepend through a separate pg_upgrade step and adjusting large-object sort priority to accommodate comments and security labels #31.
- Nathan then integrated filtered pg_shdepend data into each database's pg_dump output, added explicit ordering dependencies and catalog-column collection, and restricted the optimization to source versions PostgreSQL 12 and newer; direct file copying remained a possible but complicated further optimization #32.
- Hannu tested the revised patch successfully and proposed reconstructing dependencies from restored metadata, but benchmarks from both Hannu and Nathan favored copying the existing pg_shdepend rows, so reconstruction was dropped #33 #34 #35 #36 #37.
- Nitin Motiani traced the sort-priority inconsistency to an earlier change in large-object dump sections and recommended fixing it independently; the pg_dump_sort.c hunk from #32 landed unchanged as e43fae199e, with backports to PostgreSQL 17 and 18 #38 #41; the separately linked discussion thread #51896 contains no competing attached patchset.
- Nathan resubmitted the remaining COPY optimization with comments explaining that pre-12 hidden OID columns prevented this approach, and Nitin approved the revision #39 #40.
- Nathan prepared the optimization for commit with a dependency-ID assertion and detailed rationale, then adopted Tom's correction to use frontend-safe catalog headers #43 #44 #45.
- The final attached optimization landed as 161a3e8b68 with only a comment wording change and commit-message polishing; Nathan still hoped to investigate a hybrid of selective lo_create commands, dependency COPY and metadata-file copying for upgrades from PostgreSQL 16 onward #45 #46.
- The thread ended with the submitted work committed, while further file-copy optimization remained exploratory and Hannu's request to backport the COPY improvement met Nathan's assessment that such a departure from versioning policy was very unlikely #46 #47 #48.