You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Support Range Query on Secondary Indexes #23451
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
Performance-critical range queries: Queries like SELECT * FROM t3 WHERE b >= 9 AND b <= 10 should use index range scan instead of table scan
Large table filtering: On tables with millions of rows, range queries should leverage indexes for better performance
Time-series data: Queries filtering by date/time ranges should use indexes
Test Case
createtablet3 (a intprimary 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 >=9AND 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