model-writtenrun 1434 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Nathan Bossart proposed replacing two queries per sequence with bulk collection and sorted caches, reporting that the patches reduced a million-sequence schema-only binary-upgrade dump from roughly 115 seconds to 38 seconds on top of another optimization #1.
- After Nathan rebased the series in July, Euler Taveira benchmarked 10,000 sequences, reviewed integer parsing and string handling, and requested that metadata caching independently guard against pre-v10 servers; Nathan explained that numeric storage reduced cache memory #2 #3 #4.
- Euler clarified that his benchmark was schema-only, and Nathan revised collection to avoid reading sequence data for those dumps and simplify the v18 query, while retaining compatibility workarounds for older servers #5 #7.
- Nathan then identified a correctness flaw: pg_sequence_last_value() returns NULL when is_called is false, but ALTER SEQUENCE can make the actual value differ from seqstart; Michael Paquier confirmed the problem and supported an API returning both pieces of information #7 #8.
- Nathan considered changing the existing function but attached a separate pg_sequence_read_tuple() implementation and a fourth patch using it, preserving individual sequence-data queries for servers older than v18 #10 #14.
- Tom Lane favored preserving the existing function and view, and found that the new function must require SELECT privilege rather than accepting USAGE; Nathan applied that correction, replaced sequence-type strings with an enum, and then fixed a Windows compiler warning #15 #16 #17.
- Nathan retested the final series and reported that a schema-only dump of 10,000 sequences fell from 0.607 seconds to 0.094 seconds, with no additional overhead from including the sequence-data patches #18.
- The final series' parsing and metadata-cache components landed separately as 23687e925f and 68e9629985, with only comment edits relative to #17.
- The tuple-reading function and sequence-data cache landed as c8b06bb969 and bd15b7db48; the function received initialization cleanup and a catalog-version bump, and Nathan confirmed the whole series was committed #17 #19.
- In December 2025, Tom reopened the thread over a reported concurrent-drop regression, explaining that bulk collection touched sequences outside the requested dump and also highlighting excessive locking and garbage setval() values when the now-renamed pg_get_sequence_data() returned NULLs #20.
- Nathan and Tom settled on returning NULLs during bulk collection for missing sequences, then failing only when dumpSequenceData() actually needed an unavailable sequence; Nathan's first fix also released read locks and skipped unnecessary schema-only processing #21 #22 #23 #24 #25.
- Tom reviewed the fix and requested NULL results for non-sequence relations too; Nathan replaced the proposed try_sequence_open() API with try_relation_open() and a local relation-kind check to keep the fix smaller and easier to backpatch, and Tom accepted it #26 #27 #28.
- The revised fix landed as 39d5555766 with a clearer error message and a backpatch to PostgreSQL 18; Nathan's final message confirmed commitment, leaving no attached work outstanding #27 #29.