--source include/have_innodb.inc CREATE TABLE `t1` ( `f1` varchar(20) NOT NULL, `f2` varchar(100) NOT NULL DEFAULT '', `f3` bigint(20) NOT NULL, PRIMARY KEY (`f1`,`f3`,`f2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --disable_warnings insert into t1 values(encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 ))); insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; insert into t1 select encrypt(uuid()), uuid(), (FLOOR( 1 + RAND( ) * 60000 )) from t1; --enable_warnings update t1 set f1 = f3%100; --vertical_results explain format=json select aa.f2 , max(aa.f3) as f3 from t1 aa where f1 = '42' and f3 <= 30000 group by aa.f2; --horizontal_results flush status; --disable_result_log select aa.f2 , max(aa.f3) as f3 from t1 aa where f1 = '42' and f3 <= 30000 group by aa.f2; --enable_result_log show status like 'Handler%'; create table t2 like t1; insert into t2 select * from t1; alter table t1 drop primary key; truncate table t1; insert into t1 select * from t2; alter table t1 add primary key(`f1`,`f3`,`f2`); --vertical_results explain format=json select aa.f2 , max(aa.f3) as f3 from t1 aa where f1 = '42' and f3 <= 30000 group by aa.f2; --horizontal_results flush status; --disable_result_log select aa.f2 , max(aa.f3) as f3 from t1 aa where f1 = '42' and f3 <= 30000 group by aa.f2; --enable_result_log show status like 'Handler%'; drop table t1, t2;