1SET DEFAULT_STORAGE_ENGINE='tokudb'; 2DROP TABLE IF EXISTS t1; 3create table t1(a int, b int, c int, d int, primary key(a,b,c), key(b) clustering=yes, key (c))engine=tokudb; 4insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000); 5explain select * from t1 where a > 5; 6id select_type table type possible_keys key key_len ref rows Extra 71 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where 8select * from t1 where a > 5; 9a b c d 106 60 600 6000 117 70 700 7000 128 80 800 8000 139 90 900 9000 14explain select * from t1 where b > 30; 15id select_type table type possible_keys key key_len ref rows Extra 161 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 17select * from t1 where b > 30; 18a b c d 194 40 400 4000 205 50 500 5000 216 60 600 6000 227 70 700 7000 238 80 800 8000 249 90 900 9000 25explain select * from t1 where c > 750; 26id select_type table type possible_keys key key_len ref rows Extra 271 SIMPLE t1 range c c 4 NULL NULL; Using where 28select * from t1 where c > 750; 29a b c d 308 80 800 8000 319 90 900 9000 32explain select a from t1 where a > 8; 33id select_type table type possible_keys key key_len ref rows Extra 341 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index 35select a from t1 where a > 8; 36a 379 38explain select a,b from t1 where b > 30; 39id select_type table type possible_keys key key_len ref rows Extra 401 SIMPLE t1 index b c 4 NULL NULL; Using where; Using index 41select a,b from t1 where b > 30; 42a b 434 40 445 50 456 60 467 70 478 80 489 90 49explain select a,b from t1 where c > 750; 50id select_type table type possible_keys key key_len ref rows Extra 511 SIMPLE t1 index c c 4 NULL NULL; Using where; Using index 52select a,c from t1 where c > 750; 53a c 548 800 559 900 56alter table t1 add index bdca(b,d,c,a) clustering=yes; 57insert into t1 values (10,10,10,10); 58alter table t1 drop index bdca; 59alter table t1 drop primary key; 60explain select * from t1 where a > 5; 61id select_type table type possible_keys key key_len ref rows Extra 621 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where 63select * from t1 where a > 5; 64a b c d 656 60 600 6000 667 70 700 7000 678 80 800 8000 689 90 900 9000 6910 10 10 10 70explain select * from t1 where b > 30; 71id select_type table type possible_keys key key_len ref rows Extra 721 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 73select * from t1 where b > 30; 74a b c d 754 40 400 4000 765 50 500 5000 776 60 600 6000 787 70 700 7000 798 80 800 8000 809 90 900 9000 81explain select * from t1 where c > 750; 82id select_type table type possible_keys key key_len ref rows Extra 831 SIMPLE t1 range c c 4 NULL NULL; Using where 84select * from t1 where c > 750; 85a b c d 868 80 800 8000 879 90 900 9000 88explain select b from t1 where b > 30; 89id select_type table type possible_keys key key_len ref rows Extra 901 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 91select b from t1 where b > 30; 92b 9340 9450 9560 9670 9780 9890 99explain select b from t1 where c > 750; 100id select_type table type possible_keys key key_len ref rows Extra 1011 SIMPLE t1 range c c 4 NULL NULL; Using where 102select c from t1 where c > 750; 103c 104800 105900 106alter table t1 add e varchar(20); 107alter table t1 add primary key (a,b,c); 108explain select * from t1 where a > 5; 109id select_type table type possible_keys key key_len ref rows Extra 1101 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where 111select * from t1 where a > 5; 112a b c d e 1136 60 600 6000 NULL 1147 70 700 7000 NULL 1158 80 800 8000 NULL 1169 90 900 9000 NULL 11710 10 10 10 NULL 118explain select * from t1 where b > 30; 119id select_type table type possible_keys key key_len ref rows Extra 1201 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 121select * from t1 where b > 30; 122a b c d e 1234 40 400 4000 NULL 1245 50 500 5000 NULL 1256 60 600 6000 NULL 1267 70 700 7000 NULL 1278 80 800 8000 NULL 1289 90 900 9000 NULL 129explain select * from t1 where c > 750; 130id select_type table type possible_keys key key_len ref rows Extra 1311 SIMPLE t1 range c c 4 NULL NULL; Using where 132select * from t1 where c > 750; 133a b c d e 1348 80 800 8000 NULL 1359 90 900 9000 NULL 136explain select a from t1 where a > 8; 137id select_type table type possible_keys key key_len ref rows Extra 1381 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index 139select a from t1 where a > 8; 140a 1419 14210 143explain select a,b from t1 where b > 30; 144id select_type table type possible_keys key key_len ref rows Extra 1451 SIMPLE t1 index b c 4 NULL NULL; Using where; Using index 146select a,b from t1 where b > 30; 147a b 1484 40 1495 50 1506 60 1517 70 1528 80 1539 90 154explain select a,b from t1 where c > 750; 155id select_type table type possible_keys key key_len ref rows Extra 1561 SIMPLE t1 index c c 4 NULL NULL; Using where; Using index 157select a,c from t1 where c > 750; 158a c 1598 800 1609 900 161alter table t1 drop primary key; 162explain select * from t1 where a > 5; 163id select_type table type possible_keys key key_len ref rows Extra 1641 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where 165select * from t1 where a > 5; 166a b c d e 1676 60 600 6000 NULL 1687 70 700 7000 NULL 1698 80 800 8000 NULL 1709 90 900 9000 NULL 17110 10 10 10 NULL 172explain select * from t1 where b > 30; 173id select_type table type possible_keys key key_len ref rows Extra 1741 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 175select * from t1 where b > 30; 176a b c d e 1774 40 400 4000 NULL 1785 50 500 5000 NULL 1796 60 600 6000 NULL 1807 70 700 7000 NULL 1818 80 800 8000 NULL 1829 90 900 9000 NULL 183explain select * from t1 where c > 750; 184id select_type table type possible_keys key key_len ref rows Extra 1851 SIMPLE t1 range c c 4 NULL NULL; Using where 186select * from t1 where c > 750; 187a b c d e 1888 80 800 8000 NULL 1899 90 900 9000 NULL 190explain select b from t1 where b > 30; 191id select_type table type possible_keys key key_len ref rows Extra 1921 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index 193select b from t1 where b > 30; 194b 19540 19650 19760 19870 19980 20090 201explain select b from t1 where c > 750; 202id select_type table type possible_keys key key_len ref rows Extra 2031 SIMPLE t1 range c c 4 NULL NULL; Using where 204select c from t1 where c > 750; 205c 206800 207900 208drop table t1; 209