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

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

Wiki / 执行计划

Incremental Sort

Extends an existing ordering by sorting groups that share the presorted key prefix.

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

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

Core node tag
T_IncrementalSort
Structured EXPLAIN Node Type
Incremental Sort
Inputs
One partly ordered child plan
Output
Tuples ordered by the full sort key
Executor initializer
ExecInitIncrementalSort
Memory mechanism
tuplesort
evidence kind
source and documentation
explain names
Incremental Sort
explain prefixes
Parallel, Async
node tag
T_IncrementalSort
parallel callbacks
ExecIncrementalSortEstimate, ExecIncrementalSortInitializeDSM, ExecIncrementalSortInitializeWorker, ExecIncrementalSortRetrieveInstrumentation
partial modes
未知
runtime verified
false
strategies
未知

版本定义 PG 18

Extends an existing ordering by sorting groups that share the presorted key prefix.

EXPLAIN labels in this source build

Text-format labelStructured node identity
Incremental SortIncremental Sort

比较版本

完整来源事实

memory

{"description":"The node passes work_mem to tuplesort. Sorting can use memory or temporary files; the actual method and space use depend on the input and plan.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeIncrementalSort.c","path":"src/backend/executor/nodeIncrementalSort.c","sha256":"9fd15ce79cd3dd5c131c5bfb322039213cba9232fdfaa5b53e5f40e7d17195cf","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/utils/sort/tuplesort.c","path":"src/backend/utils/sort/tuplesort.c","sha256":"509d4cef598613bbf0725f697e1e1e33f3dfc8debed20169a6c4bf1ac9e5c2e3","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"tuplesort","source_notes":["Incremental sort may be more efficient than plain sort, particularly on large datasets, as it reduces the amount of data to sort at once, making it more likely it fits into work_mem (eliminating the need to spill to disk). But the main advantage of incremental sort is that it can start producing rows early, before sorting the whole dataset, which is a significant benefit especially for queries with LIMIT.","Because incremental sort processes (potentially many) sort batches, we need to capture tuplesort stats each time we finalize a sort state. This summary data is later used for EXPLAIN ANALYZE output."]}

source inventory

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

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

正文语言: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f