Skip to main content

Module external_sort

Module external_sort 

Source
Expand description

Byte-bounded external merge sort.

Input is divided into stable sorted runs whose exact spill encoding stays within work_mem_bytes (except for one indivisible oversized row). This is a hard bound on retained encoded row/run bytes, not Rust allocator resident bytes. Runs are written through crate::spill::SpillBuffer, then merged with a fixed fan-in. Merge reader/heap overhead is therefore constant: at most EXTERNAL_SORT_MERGE_FAN_IN decoded rows plus one byte-bounded output buffer, independent of the total run count.

Structs§

ExternalSort
Physical external sort with stable SQL ordering and optional global top-K.

Constants§

EXTERNAL_SORT_MERGE_FAN_IN
Maximum number of input runs opened by one merge operation.