1SET DEFAULT_STORAGE_ENGINE='tokudb'; 2DROP TABLE IF EXISTS t1; 3create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes)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); 5select * from t1; 6a b c d 71 10 100 1000 82 20 200 2000 93 30 300 3000 104 40 400 4000 115 50 500 5000 126 60 600 6000 137 70 700 7000 148 80 800 8000 159 90 900 9000 16update t1 set d=d+10000; 17select * from t1; 18a b c d 191 10 100 11000 202 20 200 12000 213 30 300 13000 224 40 400 14000 235 50 500 15000 246 60 600 16000 257 70 700 17000 268 80 800 18000 279 90 900 19000 28explain select * From t1 where b > 0; 29id select_type table type possible_keys key key_len ref rows Extra 301 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 31select * From t1 where b > 0; 32a b c d 331 10 100 11000 342 20 200 12000 353 30 300 13000 364 40 400 14000 375 50 500 15000 386 60 600 16000 397 70 700 17000 408 80 800 18000 419 90 900 19000 42update t1 set a=a+10000; 43select * from t1; 44a b c d 4510001 10 100 11000 4610002 20 200 12000 4710003 30 300 13000 4810004 40 400 14000 4910005 50 500 15000 5010006 60 600 16000 5110007 70 700 17000 5210008 80 800 18000 5310009 90 900 19000 54explain select * From t1 where b > 0; 55id select_type table type possible_keys key key_len ref rows Extra 561 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 57select * From t1 where b > 0; 58a b c d 5910001 10 100 11000 6010002 20 200 12000 6110003 30 300 13000 6210004 40 400 14000 6310005 50 500 15000 6410006 60 600 16000 6510007 70 700 17000 6610008 80 800 18000 6710009 90 900 19000 68update t1 set b=b+10000; 69select * from t1; 70a b c d 7110001 10010 100 11000 7210002 10020 200 12000 7310003 10030 300 13000 7410004 10040 400 14000 7510005 10050 500 15000 7610006 10060 600 16000 7710007 10070 700 17000 7810008 10080 800 18000 7910009 10090 900 19000 80explain select * From t1 where b > 0; 81id select_type table type possible_keys key key_len ref rows Extra 821 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 83select * From t1 where b > 0; 84a b c d 8510001 10010 100 11000 8610002 10020 200 12000 8710003 10030 300 13000 8810004 10040 400 14000 8910005 10050 500 15000 9010006 10060 600 16000 9110007 10070 700 17000 9210008 10080 800 18000 9310009 10090 900 19000 94drop table t1; 95create table t1(a int, b int, c int, d int, key(b) clustering=yes)engine=tokudb; 96insert into t1 values (2,20,200,2000),(4,40,400,4000),(1,10,100,1000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(3,30,300,3000),(9,90,900,9000); 97select * from t1; 98a b c d 991 10 100 1000 1002 20 200 2000 1013 30 300 3000 1024 40 400 4000 1035 50 500 5000 1046 60 600 6000 1057 70 700 7000 1068 80 800 8000 1079 90 900 9000 108update t1 set d=d+10000; 109select * from t1; 110a b c d 1111 10 100 11000 1122 20 200 12000 1133 30 300 13000 1144 40 400 14000 1155 50 500 15000 1166 60 600 16000 1177 70 700 17000 1188 80 800 18000 1199 90 900 19000 120explain select * From t1 where b > 0; 121id select_type table type possible_keys key key_len ref rows Extra 1221 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 123select * From t1 where b > 0; 124a b c d 1251 10 100 11000 1262 20 200 12000 1273 30 300 13000 1284 40 400 14000 1295 50 500 15000 1306 60 600 16000 1317 70 700 17000 1328 80 800 18000 1339 90 900 19000 134update t1 set b=b+10000; 135select * from t1; 136a b c d 1371 10010 100 11000 1382 10020 200 12000 1393 10030 300 13000 1404 10040 400 14000 1415 10050 500 15000 1426 10060 600 16000 1437 10070 700 17000 1448 10080 800 18000 1459 10090 900 19000 146explain select * From t1 where b > 0; 147id select_type table type possible_keys key key_len ref rows Extra 1481 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 149select * From t1 where b > 0; 150a b c d 1511 10010 100 11000 1522 10020 200 12000 1533 10030 300 13000 1544 10040 400 14000 1555 10050 500 15000 1566 10060 600 16000 1577 10070 700 17000 1588 10080 800 18000 1599 10090 900 19000 160alter table t1 drop key b; 161alter table t1 add key b(b) clustering=yes; 162select * from t1; 163a b c d 1641 10010 100 11000 1652 10020 200 12000 1663 10030 300 13000 1674 10040 400 14000 1685 10050 500 15000 1696 10060 600 16000 1707 10070 700 17000 1718 10080 800 18000 1729 10090 900 19000 173explain select * From t1 where b > 0; 174id select_type table type possible_keys key key_len ref rows Extra 1751 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 176select * From t1 where b > 0; 177a b c d 1781 10010 100 11000 1792 10020 200 12000 1803 10030 300 13000 1814 10040 400 14000 1825 10050 500 15000 1836 10060 600 16000 1847 10070 700 17000 1858 10080 800 18000 1869 10090 900 19000 187drop table t1; 188