Details
-
Task
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
Description
Conditions looking like
SUBSTR(str_col, 1, n) = const_str
|
where the prefix of str_col is compared against a constant value can be rewritten as range conditions as
const_str_low <= str_col <= const_str_high
|
which will improve the optimizer capabilities of building better execution plan (for example, using indexes on column str_col and applying range optimizations).
The similar transformation is already implemented for conditions like
str_col LIKE 'foo%' |
aiming for the same goal.
Similar rewrite is implemented for DATE() and YEAR() function at MDEV-8320, and that approach may be used as a reference.
Attachments
Issue Links
- relates to
-
MDEV-4414 INDEX - SUBSTRING, LEFT and others string functions that could be optimized with index
- Open