Skip to content

query: account for cursor-held buffers after Top-N compaction #20188

Description

@dantengsky

Problem

TransformSortMergeLimit compacts retained DataBlocks after heap cursors have been built. With string sort keys, cursor rows can keep the pre-compaction StringView backing buffers alive while num_bytes reflects only the compacted block. This can understate the resident memory used by local Top-N.

Follow-up to #20186.

Follow-up

  • Track cursor-held row memory per retained input block, or rebuild cursors from compacted sort rows.
  • Remove the corresponding accounting when a block is evicted, and reset it when the heap is drained.
  • Add regression coverage with synthetic sparse StringView sort keys.
  • Preserve the no-copy fast paths for discarded, dense, and non-string blocks.
  • Verify that spill decisions use the full retained-memory estimate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions