Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/6176~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/6176
Choose a head ref
  • 4 commits
  • 24 files changed
  • 2 contributors

Commits on Dec 23, 2025

  1. Add batch table AM API and heapam implementation

    Introduce new table AM callbacks to fetch multiple tuples per call.
    This reduces per-tuple call overhead by letting executor nodes work
    in batches.
    
    Define a HeapBatch structure and supporting code in tableam.h.
    Batches are limited to tuples from a single page and at most
    EXEC_BATCH_ROWS (currently 64) entries.
    
    Provide initial heapam support with heapgettup_pagemode_batch().
    No executor node is switched over yet; a later commit will adapt
    SeqScan to use this API. Other nodes may adopt it in the future.
    
    Also add pgstat_count_heap_getnext_batch() to record batched fetches
    in pgstat.
    
    Reviewed-by: Daniil Davydov <3danissimo@gmail.com>
    Discussion: https://postgr.es/m/CA+HiwqFfAY_ZFqN8wcAEMw71T9hM_kA8UtyHaZZEZtuT3UyogA@mail.gmail.com
    amitlan authored and Commitfest Bot committed Dec 23, 2025
    Configuration menu
    Copy the full SHA
    a300737 View commit details
    Browse the repository at this point in the history
  2. SeqScan: add batch-driven variants returning slots

    Teach SeqScan to drive the table AM via new the batch API added in
    the previous commit, while still returning one TupleTableSlot at a
    time to callers. This reduces per tuple AM crossings without
    changing the node interface seen by parents.
    
    Add TupleBatch and supporting code in execBatch.c/h to hold executor
    side batching state. PlanState gains ps_Batch to carry the active
    TupleBatch when a node supports batching.
    
    Wire up runtime selection in ExecInitSeqScan using
    ScanCanUseBatching(). When executor_batching is enabled, EPQ is
    inactive, the scan is not backward, and the relation supports
    batching, ps.ExecProcNode is set to a batch-driven variant. Otherwise
    the non-batch path is used.
    
    Plan shape and EXPLAIN output remain unchanged; only the internal
    tuple flow differs when batching is enabled and allowed.
    
    Add executor_batch_rows GUC to specify the maximum number of rows
    that can be added into a batch.
    
    Notes / current limits:
    
    - With the current heapam, batches are composed from a single page, so
      the batch may not always be full. Future work may let SeqScan and/or
      AMs top up batches across pages when safe to do so.
    
    Reviewed-by: Daniil Davydov <3danissimo@gmail.com>
    Discussion: https://postgr.es/m/CA+HiwqFfAY_ZFqN8wcAEMw71T9hM_kA8UtyHaZZEZtuT3UyogA@mail.gmail.com
    amitlan authored and Commitfest Bot committed Dec 23, 2025
    Configuration menu
    Copy the full SHA
    17f74e0 View commit details
    Browse the repository at this point in the history
  3. Add EXPLAIN (BATCHES) option for tuple batching statistics

    Add a BATCHES option to EXPLAIN that reports per-node batch statistics
    when a node uses batch mode execution.
    
    For nodes that support batching (currently SeqScan), this shows the
    number of batches fetched along with average, minimum, and maximum
    rows per batch. Output is supported in both text and non-text formats.
    
    Add regression tests covering text output, JSON format, filtered scans,
    LIMIT, and disabled batching.
    
    Discussion: https://postgr.es/m/CA+HiwqFfAY_ZFqN8wcAEMw71T9hM_kA8UtyHaZZEZtuT3UyogA@mail.gmail.com
    amitlan authored and Commitfest Bot committed Dec 23, 2025
    Configuration menu
    Copy the full SHA
    3caff11 View commit details
    Browse the repository at this point in the history
  4. [CF 6176] v4 - Batching in executor, part 1: add batch variant of tab…

    …le AM scan API
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6176
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CA+HiwqEZja5rJ78p3FBDZNvynWsHwanxyt6h0YaK_r84NemXng@mail.gmail.com
    Author(s): Amit Langote
    Commitfest Bot committed Dec 23, 2025
    Configuration menu
    Copy the full SHA
    9cdcfa4 View commit details
    Browse the repository at this point in the history
Loading