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, 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	5	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	5	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	range	b	b	5	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	range	c	c	5	NULL	NULL;	Using where
52select a,c from t1 where c > 750;
53a	c
548	800
559	900
56update t1 set c = c+5, b = b+5 where b>30;
57explain select * from t1 where a > 5;
58id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
591	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	NULL;	Using where
60select * from t1 where a > 5;
61a	b	c	d
626	65	605	6000
637	75	705	7000
648	85	805	8000
659	95	905	9000
66explain select * from t1 where b > 30;
67id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
681	SIMPLE	t1	index	b	b	5	NULL	NULL;	Using where; Using index
69select * from t1 where b > 30;
70a	b	c	d
714	45	405	4000
725	55	505	5000
736	65	605	6000
747	75	705	7000
758	85	805	8000
769	95	905	9000
77explain select * from t1 where c > 750;
78id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
791	SIMPLE	t1	ALL	c	NULL	NULL	NULL	NULL;	Using where
80select * from t1 where c > 750;
81a	b	c	d
828	85	805	8000
839	95	905	9000
84explain select a from t1 where a > 8;
85id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
861	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	NULL;	Using where; Using index
87select a from t1 where a > 8;
88a
899
90explain select a,b from t1 where b > 30;
91id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
921	SIMPLE	t1	NA	b	b	5	NULL	NULL;	Using where; Using index
93select a,b from t1 where b > 30;
94a	b
954	45
965	55
976	65
987	75
998	85
1009	95
101explain select a,b from t1 where c > 750;
102id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1031	SIMPLE	t1	ALL	c	NULL	NULL	NULL	NULL;	Using where
104select a,c from t1 where c > 750;
105a	c
1068	805
1079	905
108alter table t1 drop primary key;
109explain select * from t1 where a > 5;
110id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1111	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	NULL;	Using where
112select * from t1 where a > 5;
113a	b	c	d
1146	65	605	6000
1157	75	705	7000
1168	85	805	8000
1179	95	905	9000
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	5	NULL	NULL;	Using where; Using index
121select * from t1 where b > 30;
122a	b	c	d
1234	45	405	4000
1245	55	505	5000
1256	65	605	6000
1267	75	705	7000
1278	85	805	8000
1289	95	905	9000
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	5	NULL	NULL;	Using where
132select * from t1 where c > 750;
133a	b	c	d
1348	85	805	8000
1359	95	905	9000
136explain select a from t1 where a > 5;
137id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1381	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	NULL;	Using where
139select a from t1 where a > 5;
140a
1416
1427
1438
1449
145explain select a,b from t1 where b > 30;
146id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1471	SIMPLE	t1	range	b	b	5	NULL	NULL;	Using where; Using index
148select a,b from t1 where b > 30;
149a	b
1504	45
1515	55
1526	65
1537	75
1548	85
1559	95
156explain select a,b from t1 where c > 750;
157id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1581	SIMPLE	t1	range	c	c	5	NULL	NULL;	Using where
159select a,c from t1 where c > 750;
160a	c
1618	805
1629	905
163update t1 set c = c+5, b = b+5 where b>30;
164select * from t1;
165a	b	c	d
1661	10	100	1000
1672	20	200	2000
1683	30	300	3000
1694	50	410	4000
1705	60	510	5000
1716	70	610	6000
1727	80	710	7000
1738	90	810	8000
1749	100	910	9000
175explain select * from t1 where a > 5;
176id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1771	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	NULL;	Using where
178select * from t1 where a > 5;
179a	b	c	d
1806	70	610	6000
1817	80	710	7000
1828	90	810	8000
1839	100	910	9000
184explain select * from t1 where b > 30;
185id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1861	SIMPLE	t1	index	b	b	5	NULL	NULL;	Using where; Using index
187select * from t1 where b > 30;
188a	b	c	d
1894	50	410	4000
1905	60	510	5000
1916	70	610	6000
1927	80	710	7000
1938	90	810	8000
1949	100	910	9000
195explain select * from t1 where c > 750;
196id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1971	SIMPLE	t1	ALL	c	NULL	NULL	NULL	NULL;	Using where
198select * from t1 where c > 750;
199a	b	c	d
2008	90	810	8000
2019	100	910	9000
202explain select a from t1 where a > 5;
203id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
2041	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	NULL;	Using where
205select a from t1 where a > 5;
206a
2076
2087
2098
2109
211explain select a,b from t1 where b > 30;
212id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
2131	SIMPLE	t1	index	b	b	5	NULL	NULL;	Using where; Using index
214select a,b from t1 where b > 30;
215a	b
2164	50
2175	60
2186	70
2197	80
2208	90
2219	100
222explain select a,b from t1 where c > 750;
223id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
2241	SIMPLE	t1	ALL	c	NULL	NULL	NULL	NULL;	Using where
225select a,c from t1 where c > 750;
226a	c
2278	810
2289	910
229drop table t1;
230