↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Plan Nodes

WindowAgg

Evaluates window functions over ordered partitions of its child output.

Reading PG 18·Select a recorded version

Core node tag
T_WindowAgg
Structured EXPLAIN Node Type
WindowAgg
Inputs
One suitably ordered child plan
Output
Tuples with window-function results
Executor initializer
ExecInitWindowAgg
Memory mechanism
tuplestore
evidence kind
source and documentation
explain names
WindowAgg
explain prefixes
Parallel, Async
node tag
T_WindowAgg
parallel callbacks
Unknown
partial modes
Unknown
runtime verified
false
strategies
Unknown

Definition PG 18

Evaluates window functions over ordered partitions of its child output.

EXPLAIN labels in this source build

Text-format labelStructured node identity
WindowAggWindowAgg

Compare versions

Complete source facts

memory

{"description":"This node creates a tuplestore with work_mem. The tuplestore can move stored tuples to temporary files; this does not make work_mem a cap on every allocation made by the node.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeWindowAgg.c","path":"src/backend/executor/nodeWindowAgg.c","sha256":"c365e6750bc77a89562254903d099c3e5914e001d3aae418322ccffc1d535d17","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/utils/sort/tuplestore.c","path":"src/backend/utils/sort/tuplestore.c","sha256":"27a85416bafed557006c705ab5d0c5dce3d3c1702812bb54d136f2ac4c41055a","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"tuplestore","source_notes":["If the tuplestore has spilled to disk, alternate reading and writing becomes quite expensive due to frequent buffer flushes. It's cheaper to force the entire partition to get spooled in one go.","Read the current row from the tuplestore, and save in ScanTupleSlot. (We can't rely on the outerplan's output slot because we may have to read beyond the current row. Also, we have to actually copy the row out of the tuplestore, since window function evaluation might cause the tuplestore to dump its state to disk.)","Window functions do not have to call this, but are encouraged to move the mark forward when possible to keep the tuplestore size down and prevent having to spill rows to disk."]}

source inventory

{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeWindowAgg.c"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

Text language: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f