--source include/have_innodb.inc create table test( seq int not null primary key auto_increment, grp int not null, txt varchar(64), key ix_test(grp), key ix_test2(grp,seq) ) engine=innodb; insert into test (grp, txt) select 1, md5(rand()) from dual; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 1, md5(rand()) from test; insert into test (grp, txt) select 2, md5(rand()) from test; insert into test (grp, txt) select 2, md5(rand()) from test; insert into test (grp, txt) select 2, md5(rand()) from test; insert into test (grp, txt) select 3, md5(rand()) from test; insert into test (grp, txt) select 3, md5(rand()) from test; insert into test (grp, txt) select 4, md5(rand()) from test; insert into test (grp, txt) select 4, md5(rand()) from test; analyze table test; select now(); select * from test where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; select now(); select * from test use index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; select now(); select * from test force index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; select now(); explain select * from test where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; explain select * from test use index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; explain select * from test force index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; flush status; select * from test where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; show status like 'Handler%'; flush status; select * from test use index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; show status like 'Handler%'; flush status; select * from test force index(ix_test) where grp = 4 and seq <= 1851933 order by grp desc, seq desc limit 1; show status like 'Handler%';