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/5595~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/5595
Choose a head ref
  • 5 commits
  • 53 files changed
  • 2 contributors

Commits on Aug 10, 2025

  1. Store working memory limit per Plan/SubPlan, rather than in GUC

    This commit moves the working-memory limit that an executor node checks, at
    runtime, from the "work_mem" and "hash_mem_multiplier" GUCs, to a new
    list, "workMemLimits", added to the PlannedStmt node. At runtimem an exec
    node checks its limit by looking up the list element corresponding to its
    plan->workmem_id field.
    
    Indirecting the workMemLimit via a List index allows us to handle SubPlans
    as well as Plans. It also allows a future extension to set limits on
    individual Plans/SubPlans, without needing to re-traverse the Plan +
    Expr tree.
    
    To preserve backward, this commit also copies the "work_mem", etc., values
    from the existing GUCs to the new field. This means that this commit is
    just a refactoring, and doesn't change any behavior.
    
    This "workmem_id" field is on the Plan node, instead of the corresponding
    PlanState, because the workMemLimit needs to be set before we can call
    ExecInitNode().
    James Hunter authored and Commitfest Bot committed Aug 10, 2025
    Configuration menu
    Copy the full SHA
    be38214 View commit details
    Browse the repository at this point in the history
  2. Add "workmem" estimates to Path node and PlannedStmt

    To allow for future optimizers to make decisions at Path time, this commit
    aggregates the Path's total working memory onto the Path's "workmem" field,
    normalized to a minimum of 64 KB and rounded up to the next whole KB.
    
    To allow future hooks to override ExecAssignWorkMem(), this commit then
    breaks that total working memory into per-data structure working memory,
    and stores it, next to the workMemLimit, on the PlannedStmt.
    James Hunter authored and Commitfest Bot committed Aug 10, 2025
    Configuration menu
    Copy the full SHA
    4e75749 View commit details
    Browse the repository at this point in the history
  3. Add EXPLAIN (work_mem on) command option

    So that users can see how much working memory a query is likely to use, as
    well as how much memory it will be limited to, this commit adds an
    EXPLAIN (work_mem on) command option that displays the workmem estimate
    and limit, added in the previous two commits.
    James Hunter authored and Commitfest Bot committed Aug 10, 2025
    Configuration menu
    Copy the full SHA
    c23115a View commit details
    Browse the repository at this point in the history
  4. Add "workmem_hook" to allow extensions to override per-node work_mem

    James Hunter authored and Commitfest Bot committed Aug 10, 2025
    Configuration menu
    Copy the full SHA
    65acdaf View commit details
    Browse the repository at this point in the history
  5. [CF 5595] Track and display estimated "work_mem" as well as limit, vi…

    …a EXPLAIN (work_mem on); add hook to override work_mem limits; add extension to override using "workmem.query_work_mem" GUC
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5595
    
    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/[email protected]
    Author(s): James Hunter
    Commitfest Bot committed Aug 10, 2025
    Configuration menu
    Copy the full SHA
    a0abe67 View commit details
    Browse the repository at this point in the history
Loading