Skip to content

SortPreservingMerge does not account for memory usage #5885

@tustvold

Description

@tustvold

Is your feature request related to a problem or challenge?

SortPreservingMerge currently has extremely limited memory accounting functionality, with no accounting for buffered batches or cursors.

The only memory accounting is a static assignment at construction time by ExternalSorter of the size of the in memory batches, when merging spilled and in-memory data. This assignment is never decremented, and does not take into account any memory usage resulting from loading the spilled data back into memory.

Describe the solution you'd like

SortPreservingMerge should account for the memory usage of the data it has buffered

Additionally the various streams created by ExternalSorter, both for in-memory and spilled data, should be accounted for

Describe alternatives you've considered

No response

Additional context

#5879 tracks unifying the sorting implementations, which may help make this story more consistent.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions