model-writtenrun 5078 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Jun 2020 - Apr 2021 · 19 entries
- Andrei Lepikhov opened the thread with a prototype derived from Arseny Sher's earlier private work, buffering rows for foreign partitions and sending remote COPY commands instead of individual INSERTs, with a large benchmark improvement #1.
- Lepikhov explained that partitions sharing one server also share a connection, so concurrent remote COPY operations and error cleanup required care; his design completed one remote COPY per buffer flush #3.
- Ashutosh Bapat supplied reusable column-list deparsing and tests for dropped or absent columns, which Lepikhov incorporated while falling back from bulk COPY for zero-column input #4 #5.
- Etsuro Fujita questioned coupling the FDW interface to core buffer limits and supported a separate bulk API; Lepikhov temporarily consolidated the implementation into ExecForeignBulkInsert #6 #7.
- Bapat identified unnecessary INSERT initialization, leading Lepikhov to introduce separate COPY initialization and termination callbacks plus a per-relation flag for selecting the appropriate interface during partition routing #8 #10.
- Amit Langote supplied a delta that delivered serialized rows directly through an FDW callback and kept remote COPY open across flushes; Lepikhov adopted the callback but rejected the persistent session because multiple partitions could share one connection #11 #12 #13.
- Langote reproduced a failure involving a foreign partition with a BEFORE trigger and supplied centralized multi-insert eligibility checks, which Lepikhov integrated with regression coverage before Langote split the refactoring from the feature #20 #21 #22.
- Alexey Kondratov found inconsistent callback names and challenged the extra InitResultRelInfo parameter, prompting an alternative refactoring and a corrected two-patch submission #27 #31 #32.
- Lepikhov then moved eligibility checking into a separate function and added experimental patches that allocated separate connections so each partition could use one long-lived remote COPY operation #35.
- Langote supplied another cleanup delta, which Lepikhov folded into the basic two-patch series while explicitly suspending maintenance of the experimental connection patches pending discussion #36 #37.
- Lepikhov identified a remaining error-reporting problem: failures discovered after a remote batch completed could show a misleading local input line number #38.
- Takayuki Tsunakawa reviewed callback contracts, optional initialization functions, output formatting, and libpq error handling; Lepikhov incorporated many corrections, while questions about eligibility-state ownership remained #39 #40 #41.
- After Tomas Vondra rebased the series, Langote and Tsunakawa debated how COPY should communicate batching choices to partition initialization; Lepikhov subsequently updated optional callback handling and rebased across the COPY source-file split #42 #48 #50 #51 #53.
- Hou Zhijie identified redundant exception rethrowing and debugging leftovers, which Lepikhov removed, while Haiying Tang reported strong improvements across seven performance tests of the original remote-COPY design #56 #57 #58.
- Following further bit rot, Tsunakawa took over updating the patch with Lepikhov's agreement, merged the basic components, corrected optional callback checks, and clarified the eligibility helper's name #63 #64 #66.
- Tsunakawa argued that separate connections added too much complexity and suggested addressing buffer limits separately; Lepikhov agreed to focus on the basic feature #68 #69.
- Justin Pryzby diagnosed a partition initialization crash caused by upstream range-table changes, and Tsunakawa adapted the patch before incorporating Langote's further simplifications to callback arguments and tuple-descriptor handling #72 #73 #74 #75.
- Pryzby's language corrections and missing-switch-break report, followed by Zhihong Yu's error-status review, produced another correction round; later revisions handled upstream changes and a gettext linking issue #77 #78 #79 #80 #83 #85 #86.
- The remote-COPY version remained uncommitted at the PostgreSQL 14 deadline, and Fujita said his unfinished review would continue for the next release #90 #93.
Jun 2021 · 2 entries
- Lepikhov restarted the implementation around the existing foreign batch-insert API, eliminating new COPY callbacks and reporting better benchmark results; Tsunakawa raised concerns about remote INSERT semantics and lost opportunities for specialized bulk-loading APIs, which Lepikhov treated as possible future work #94 #95 #96.
- The next revision corrected batch slot advancement and regression failures, but after a long gap Fujita found that the core must permit FDW AFTER triggers and questioned the invasive executor eligibility refactoring; Lepikhov rebased and removed the invalid trigger assertion #97 #99 #101.
Jul - Oct 2022 · 9 entries
- Ian Barwick reproduced failures when empty partition buffers reached ExecForeignBatchInsert, supplied a test setup, and reported an eightfold speedup after fixing the problem; Lepikhov adopted a while-loop guard that skipped empty batches #102 #104 #105 #106 #107.
- Fujita substantially simplified the patch by extending the existing CopyInsertMethod logic instead of adding executor-wide state, checking both batching callbacks, and letting postgres_fdw decide whether zero-column tables could be batched #108.
- Lepikhov questioned whether a partition with triggers needed to flush other partitions' pending rows; Fujita explained that volatile BEFORE triggers can query the parent and must see preceding modifications, so the existing visibility rule was retained #111 #112 #115 #116.
- Fujita corrected generic FDW trigger handling to use returned slots and initialize tableoid, delayed row counts and progress updates until insertion actually occurred, and avoided allocating local bulk-insert state for foreign tables #117.
- The same revision suppressed unreliable line numbers in batch errors; Lepikhov proposed additional context or line ranges, but accepted leaving them out because partition routing could make those ranges misleading #117 #120 #121 #122.
- Yu suggested moving the relation OID lookup outside the trigger loop, and Fujita incorporated that cleanup while adding documentation and independent batching tests that preserved coverage of default single-row behavior #118 #119 #124.
- Fujita removed an impossible foreign-table transition-table condition, then added assertions requested by Lepikhov to verify the relationship between relation type and BulkInsertState; Lepikhov accepted the final revision #125 #126 #127 #128.
- Fujita committed 97da48246d from #127, changing only a BulkInsertState comment before landing batch insertion for COPY into foreign tables through the existing batch_size option #129.
- Fujita proposed treating any renewed remote-COPY work as a separate submission, and Lepikhov declined to pursue it because its remaining performance gain was about twenty percent and the patch was invasive; the commitfest entry was closed with that alternative left for future work #130 #131 #132.