model-writtenrun 8392 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tomas Vondra opened the thread with TPC-H results showing severely fragmented hash-aggregation spill I/O and planner estimates favoring a much slower hash plan over sorted aggregation #1.
- Jeff Davis outlined costing adjustments, reduced partition fanout, BufFile alternatives, and tape preallocation; Tomas favored improving the I/O behavior before modeling its cost and suggested allocating block numbers in chunks #2 #3.
- Jeff supplied a prototype reserving 32 block numbers per tape, and Tomas's SSD benchmarks showed progressively better performance and larger I/O requests when increasing that reservation to 64 and 128 blocks #4 #5.
- Tomas corrected his initial spill-volume comparison and discovered that hash aggregation was spilling unnecessary columns; his independent CP_SMALL_TLIST patch sharply reduced execution time #6 #7.
- Further SATA and SSD tests showed that preallocation and projection worked best together, while Jeff's review identified extra Subquery Scan nodes caused by requesting projection indiscriminately #8 #10 #12.
- Jeff and Tomas agreed to grow reservations gradually to limit wasted space; Tomas withdrew his proposed contiguous-range allocation API after Jeff explained that free blocks come from a minheap, and Jeff posted a revision growing from 8 to 128 blocks and reclaiming unused reservations #13 #14 #16 #17 #18.
- Tomas's broader tests confirmed large improvements but exposed parallel plans that repeated the entire aggregation in every worker; discussion examined group counts, worker selection, and I/O costing, and raising random_page_cost eliminated the troublesome plans in his tests #20 #21 #22 #23 #25.
- Thomas Munro explained possible read-ahead limitations and suggested maintaining enough block-location information for explicit prefetching; Tomas supplied additional I/O measurements, and Jeff proposed storing a future block pointer in each tape trailer, with prefetching deferred to PostgreSQL 14 #26 #27 #28 #29.
- Jeff committed the preallocation revision from #18 as 896ddf9b3c, retaining the 128-block maximum while adjusting allocation logic, assertions, and comments, and announced the landing in #30.
- Melanie Plageman tested the simpler projection approach and found that her earlier concern about insufficient column elimination did not hold; Tomas then extended the patch to grouping sets and restricted projection requests to avoid unnecessary plan nodes #31 #32 #33.
- Jeff posted the PostgreSQL 14 prefetch prototype using a circular preallocation buffer and future-block pointers, reporting that it produced no improvement on his SSD and suggesting magnetic-storage testing #34.
- Jeff questioned the AGG_MIXED condition, prompting Tomas to restrict both aggregation-plan constructors to AGG_HASHED; Jeff approved the revised attachment #35 #36 #37.
- Tomas committed the projection revision from #36 as 4cad2534da, with clearer comments and postgres_fdw expected-output adjustments, and later confirmed the landing when Alvaro Herrera asked about closing the open item #38 #39.
- The thread ended with Tomas recommending closure of the PostgreSQL 13 open item: both fixes had landed, additional costing changes were considered unnecessary for now, and the PostgreSQL 14 prefetch prototype remained uncommitted in the supplied record #40 #41 #34.