Description
Repro from: Marco Greco , Bingjie Miao
CREATE INDEX `ix1` ON `default`(c1); |
CREATE INDEX `ix2` ON `default`(upper(c1)) ; |
EXPLAIN select raw count(1) as count from default as b where upper(c1) like 'abc_xyz_%' |
EXPLAIN select b.* from default as b where upper(c1) like 'abc%'; |
We randomly pick the index because both has same sargable keys.
If sargable keys same try to see if we can further explore (some of the options) before random selection.
- If key pos depends on other give preference
- If span is not full span (not superset) give preference.