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/6023~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/6023
Choose a head ref
  • 8 commits
  • 29 files changed
  • 2 contributors

Commits on Dec 25, 2025

  1. Instrumentation: Keep time fields as instrtime, require caller to con…

    …vert
    
    Previously the Instrumentation logic always converted to seconds, only for many
    of the callers to do unnecessary division to get to milliseconds. Since an upcoming
    refactoring will split the Instrumentation struct, utilize instrtime always to
    keep things simpler.
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    46f95d6 View commit details
    Browse the repository at this point in the history
  2. Separate node and trigger instrumentation from other use of Instrumen…

    …tation struct
    
    Previously different places (e.g. query "total time") were repurposing
    the Instrumentation struct initially introduced for capturing per-node
    statistics during execution. This overuse of the same struct is confusing,
    e.g. by cluttering calls of InstrStartNode/InstrStopNode in unrelated
    code paths, and prevents future refactorings.
    
    Instead, simplify the Instrumentation struct to only track time and
    WAL/buffer usage. Similarly, drop the use of InstrEndLoop outside of
    per-node instrumentation - these calls were added without any apparent
    benefit since the relevant fields were never read.
    
    Introduce the NodeInstrumentation struct to carry forward the per-node
    instrumentation information, and introduce TriggerInstrumentation to
    capture trigger timing and firings (previously counted in "ntuples").
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    a5cb86c View commit details
    Browse the repository at this point in the history
  3. Replace direct changes of pgBufferUsage/pgWalUsage with INSTR_* macros

    This encapsulates the ownership of these globals better, and will allow
    a subsequent refactoring.
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    dc918a0 View commit details
    Browse the repository at this point in the history
  4. Optimize measuring WAL/buffer usage through stack-based instrumentation

    Previously, in order to determine the buffer/WAL usage of a given code section,
    we utilized continuously incrementing global counters that get updated when the
    actual activity (e.g. shared block read) occurred, and then calculated a diff when
    the code section ended. This resulted in a bottleneck for executor node instrumentation
    specifically, with the function BufferUsageAccumDiff showing up in profiles and
    in some cases adding up to 10% overhead to an EXPLAIN (ANALYZE, BUFFERS) run.
    
    Instead, introduce a stack-based mechanism, where the actual activity writes
    into the current stack entry. In the case of executor nodes, this means that
    each node gets its own stack entry that is pushed at InstrStartNode, and popped
    at InstrEndNode. Stack entries are zero initialized (avoiding the diff mechanism)
    and get added to their parent entry when they are finalized, i.e. no more
    modifications can occur.
    
    To correctly handle abort situations, any use of instrumentation stacks must
    involve either a top-level Instrumentation struct, and its associated InstrStart/
    InstrStop helpers (which use resource owners to handle aborts), or dedicated
    PG_TRY/PG_FINALLY calls that ensure the stack is in a consistent state after
    an abort.
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    4fecc84 View commit details
    Browse the repository at this point in the history
  5. Use Instrumentation stack for parallel query aggregation in workers

    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    050ea03 View commit details
    Browse the repository at this point in the history
  6. Convert remaining users of pgBufferUsage to use InstrStart/InstrStop,…

    … drop the global
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    6189c02 View commit details
    Browse the repository at this point in the history
  7. Index scans: Split heap and index buffer access reporting in EXPLAIN

    This makes it clear whether activity was on the index directly, or
    on the table based on heap fetches.
    lfittl authored and Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    8d93481 View commit details
    Browse the repository at this point in the history
  8. [CF 6023] v4 - Stack-based tracking of per-node WAL/buffer usage

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6023
    
    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/CAP53PkzZ3UotnRrrnXWAv=F4avRq9MQ8zU+bxoN9tpovEu6fGQ@mail.gmail.com
    Author(s): Lukas Fittl
    Commitfest Bot committed Dec 25, 2025
    Configuration menu
    Copy the full SHA
    2701adb View commit details
    Browse the repository at this point in the history
Loading