On Thu, Jan 29, 2026 at 8:35 AM Amit Langote <[email protected]> wrote: > > Hi, > > Here is v5 of the patch series. > > Patches 0001-0003 add the core batching infrastructure. 0001 adds the > batch table AM API with heapam implementation, 0002 wires up SeqScan > to use it (still returning one slot at a time), and 0003 adds EXPLAIN > (BATCHES). I'd love to hear people's thoughts around TupleBatch > structure added in 0002. I thought about making it a separate patch so > that 0002 will still populate the single ScanState.ss_scanTupleSlot, > but that means we'd still have to call the TAM callback to populate > the tuple in the TAM's batch struct into the slot, defeating the whole > point. With TupleBatch, you have executor_batch_rows number of slots > which are filled in one TAM callback (materialize_all) call. So I > decided to keep the TupleBatch and related things in 0002. > > For scans without quals, batching shows 20-30% improvement with no > visible regressions when batching is disabled (batch_rows=0): > > SELECT * FROM t LIMIT n (no qual) > > Rows Master batch=0 %diff batch=64 %diff > ------ -------- ------- ----- -------- ----- > 1M 12.42 ms 11.96 ms 3.7% 8.56 ms 31.0% > 3M 38.95 ms 38.92 ms 0.1% 28.59 ms 26.6% > 10M 153.64 ms 150.28 ms 2.2% 112.95 ms 26.5% > > (%diff: positive = faster than master, negative = slower)
Oops, I meant SELECT * FROM t LIMIT 1 OFFSET n (no qual). -- Thanks, Amit Langote
