# Simplified testcase derived from index_merge.test (dedicated to MyISAM) --echo # MyISAM instead of InnoDB removes the problem # let $engine_type = MyISAM; let $engine_type = InnoDB; eval SET SESSION STORAGE_ENGINE = $engine_type; --disable_warnings drop table if exists t0; --enable_warnings # Create and fill a table with simple keys create table t0 ( key1 int not null, key2 int not null default 0, key3 int not null default 0 ); insert into t0(key1) values (1),(2),(3),(4),(5),(6),(7),(8); let $1=7; set @d=8; while ($1) { eval insert into t0 (key1) select key1+@d from t0; eval set @d=@d*2; dec $1; } alter table t0 add index i2(key2); alter table t0 add index i3(key3); update t0 set key2=key1,key3=key1; # analyze table t0; explain select * from t0 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); --echo # Here comes a too small result set. select * from t0 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); explain select * from t0 where (key2 >32 and key2 < 40) or (key3 > 30 and key3<35); --echo # Here comes a too small result set. select * from t0 where (key2 >32 and key2 < 40) or (key3 > 30 and key3<35); --echo # Please note that the optimizer strategy looks very similar explain select * from t0 where (key3 BETWEEN 30 + 1 and 35 - 1) or (key2 BETWEEN 32 + 1 and 40 - 1); select * from t0 where (key3 BETWEEN 30 + 1 and 35 - 1) or (key2 BETWEEN 32 + 1 and 40 - 1); DROP TABLE t0;