Skip to content

[Feature Request]: Support Range Query on Secondary Indexes #23451

Closed

Description

@XuPeng-SH

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

Currently, MatrixOne secondary indexes only support equality queries (prefix_eq). Range queries on indexed columns fall back to full table scans with block-level filtering (zonemap), which is inefficient for large datasets.

Describe the feature you'd like

Support range queries (>=, <=, >, <, BETWEEN) on secondary indexes to enable efficient index range scans, similar to MySQL and other databases.

Use Cases

  1. Performance-critical range queries: Queries like SELECT * FROM t3 WHERE b >= 9 AND b <= 10 should use index range scan instead of table scan
  2. Large table filtering: On tables with millions of rows, range queries should leverage indexes for better performance
  3. Time-series data: Queries filtering by date/time ranges should use indexes

Test Case

create table t3 (a int primary key, b int, key `bk`(`b`));
insert into t3 (select *,* from generate_series(1,20000000,1)g);

-- Current behavior: Table Scan (inefficient)
EXPLAIN SELECT * FROM t3 WHERE b >= 9 AND b <= 10;

-- Expected behavior: Index Range Scan

Current Behavior

  • Equality queries use index: SELECT * FROM t3 WHERE b = 9 → Index Table Scan ✓
  • Range queries use table scan: SELECT * FROM t3 WHERE b >= 9 AND b <= 10 → Table Scan ✗

Activity

  1. added this to the MO-202601 milestone on Jan 5, 2026
  2. added
    severity/s0
    on Jan 5, 2026
  3. added theissue type on Jan 5, 2026
  4. assigned and unassigned on Feb 3, 2026
  5. ghost removed this from the MO-202601 milestone on Feb 9, 2026
  6. ghost added this to the MO-202602 milestone on Feb 9, 2026
  7. Repository owner unassigned on Feb 9, 2026
  8. ghost assigned on Feb 9, 2026
  9. assigned and unassigned on May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featureseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions