↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 执行计划

Aggregate

Computes aggregate results using the selected grouping strategy and aggregation stage.

当前阅读 PG 18·选择有来源记录的版本

此版本暂无所选语言的定义,以下显示原始英文内容。

Core node tag
T_Agg
Structured EXPLAIN Node Type
Aggregate
Inputs
One child plan
Output
Aggregate result tuples
Executor initializer
ExecInitAgg
Memory mechanism
aggregate-spill
EXPLAIN strategies
Plain, Sorted, Hashed, Mixed
Aggregation stages
Partial, Finalize, Simple
evidence kind
source and documentation
explain names
Aggregate, GroupAggregate, HashAggregate, MixedAggregate
explain prefixes
Parallel, Async
node tag
T_Agg
parallel callbacks
ExecAggEstimate, ExecAggInitializeDSM, ExecAggInitializeWorker, ExecAggRetrieveInstrumentation
partial modes
Partial, Finalize, Simple
runtime verified
false
strategies
Plain, Sorted, Hashed, Mixed

版本定义 PG 18

Computes aggregate results using the selected grouping strategy and aggregation stage.

EXPLAIN labels in this source build

Text-format labelStructured node identity
AggregateAggregate
GroupAggregateAggregate
HashAggregateAggregate
MixedAggregateAggregate

比较版本

完整来源事实

memory

{"description":"This implementation contains a disk-spill path for hashed aggregation. Aggregate input sorting and transition-state allocations have their own behavior; one spill policy does not describe every aggregation strategy.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeAgg.c","path":"src/backend/executor/nodeAgg.c","sha256":"8719569a73f054e9026c0a00c814f60b6c7879753c58e4e6dcc38fee333c45c5","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"aggregate-spill","source_notes":["When performing hash aggregation, if the hash table memory exceeds the limit (see hash_agg_check_limits()), we enter \"spill mode\". In spill mode, we advance the transition states only for groups already in the hash table. For tuples that would need to create a new hash table entries (and initialize new transition states), we instead spill them to disk to be processed later. The tuples are spilled in a partitioned manner, so that subsequent batches are smaller and less likely to exceed hash_mem (if a batch does exceed hash_mem, it must be spilled recursively).","Spilled data is written to logical tapes. These provide better control over memory usage, disk space, and the number of files than if we were to use a BufFile for each spill. We don't know the number of tapes needed at the start of the algorithm (because it can recurse), so a tape set is allocated at the beginning, and individual tapes are created as needed. As a particular tape is read, logtape.c recycles its disk space. When a tape is read to completion, it is destroyed entirely.","Control how many partitions are created when spilling HashAgg to disk.","We also specify a min and max number of partitions per spill. Too few might mean a lot of wasted I/O from repeated spilling of the same tuples. Too many will result in lots of memory wasted buffering the spill files (which could instead be spent on a larger hash table)."]}

source inventory

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

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

正文语言: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f