Summary
Carried forward from #527 (epic #421, closed without full completion).
Verified via codebase search: LIKE/GLOB prefix-to-index-range rewriting has
zero matches anywhere in src/. BETWEEN handling exists in expression
codegen (src/codegen/select/aggregate.rs, src/codegen/select/join_order.rs)
but it's unconfirmed whether it collapses to a single index range seek
versus two separate constraints. IN-list-to-multiple-index-seeks is also
unverified.
Techniques
| Technique |
Description |
Priority |
| LIKE/GLOB prefix |
LIKE 'foo%' → index range >= 'foo' AND < 'fop' |
High |
| BETWEEN → range |
x BETWEEN 5 AND 10 → x >= 5 AND x <= 10 with single index seek |
Medium |
| IN list optimization |
x IN (1,2,3) → multiple index seeks |
Medium |
Acceptance criteria
Complexity
Estimate: medium
Reasoning: LIKE prefix extraction needs a literal-prefix analysis of the
pattern (bail out on leading wildcard/escape edge cases) plus wiring into
the planner's range-constraint machinery — new code path. BETWEEN/IN need
verification first (may already partially work) and then closing gaps in
src/planner.rs / index-seek codegen if they don't collapse as expected.
Refs: #527
Summary
Carried forward from #527 (epic #421, closed without full completion).
Verified via codebase search: LIKE/GLOB prefix-to-index-range rewriting has
zero matches anywhere in
src/. BETWEEN handling exists in expressioncodegen (
src/codegen/select/aggregate.rs,src/codegen/select/join_order.rs)but it's unconfirmed whether it collapses to a single index range seek
versus two separate constraints. IN-list-to-multiple-index-seeks is also
unverified.
Techniques
LIKE 'foo%'→ index range>= 'foo' AND < 'fop'x BETWEEN 5 AND 10→x >= 5 AND x <= 10with single index seekx IN (1,2,3)→ multiple index seeksAcceptance criteria
EXPLAIN QUERY PLANshows index usage forLIKE 'prefix%'x IN (...)against an indexed column uses one seek per value, not afull scan
Complexity
Estimate: medium
Reasoning: LIKE prefix extraction needs a literal-prefix analysis of the
pattern (bail out on leading wildcard/escape edge cases) plus wiring into
the planner's range-constraint machinery — new code path. BETWEEN/IN need
verification first (may already partially work) and then closing gaps in
src/planner.rs/ index-seek codegen if they don't collapse as expected.Refs: #527