Skip to content

perf(executor): optimize ORDER BY + LIMIT with top-k #145

@aviralgarg05

Description

@aviralgarg05

Summary

Optimize ORDER BY ... LIMIT N execution using top-k selection instead of full sort when safe.

Why

Current implementation sorts all candidate rows even when only a small prefix is needed.

Tasks

  • Update execution logic in nexum_core/src/executor/mod.rs
  • Use a bounded structure (or equivalent approach) for top-k ordering
  • Add benchmark coverage in nexum_core/benches/executor_bench.rs

Acceptance Criteria

  • Query results remain identical to full-sort behavior
  • Benchmark shows reduced runtime for large datasets with small LIMIT
  • Code is covered by regression tests

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions