Commit 642aa436 authored by Sergei Golubchik's avatar Sergei Golubchik

clustering == covering

tell the optimizer that every TokuDB "clustering" index is the "covering" index
in the MariaDB optimizer sense.
parent 9a3b9a54
...@@ -4612,6 +4612,9 @@ int ha_tokudb::index_init(uint keynr, bool sorted) { ...@@ -4612,6 +4612,9 @@ int ha_tokudb::index_init(uint keynr, bool sorted) {
keynr = primary_key; keynr = primary_key;
} }
tokudb_active_index = keynr; tokudb_active_index = keynr;
if (keynr < table->s->keys && table->key_info[keynr].option_struct->clustering)
key_read = false;
last_cursor_error = 0; last_cursor_error = 0;
range_lock_grabbed = false; range_lock_grabbed = false;
...@@ -5937,6 +5940,11 @@ int ha_tokudb::info(uint flag) { ...@@ -5937,6 +5940,11 @@ int ha_tokudb::info(uint flag) {
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
uint curr_num_DBs = table->s->keys + test(hidden_primary_key); uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
DB_BTREE_STAT64 dict_stats; DB_BTREE_STAT64 dict_stats;
for (uint i=0; i < table->s->keys; i++)
if (table->key_info[i].option_struct->clustering)
table->covering_keys.set_bit(i);
if (flag & HA_STATUS_VARIABLE) { if (flag & HA_STATUS_VARIABLE) {
// Just to get optimizations right // Just to get optimizations right
stats.records = share->rows + share->rows_from_locked_table; stats.records = share->rows + share->rows_from_locked_table;
......
...@@ -5,7 +5,7 @@ create table z1 (a int, b int, c int, d int, e int, key (a) clustering=yes); ...@@ -5,7 +5,7 @@ create table z1 (a int, b int, c int, d int, e int, key (a) clustering=yes);
insert into z1 values (1,1,1,1,1),(7,7,7,7,7),(4,4,4,4,4),(3,3,3,3,3),(5,5,5,5,5),(2,2,2,2,2),(6,6,6,6,6); insert into z1 values (1,1,1,1,1),(7,7,7,7,7),(4,4,4,4,4),(3,3,3,3,3),(5,5,5,5,5),(2,2,2,2,2),(6,6,6,6,6);
explain select * From z1 order by a; explain select * From z1 order by a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE z1 index NULL a 5 NULL 7 1 SIMPLE z1 index NULL a 5 NULL 7 Using index
select * from z1 order by a; select * from z1 order by a;
a b c d e a b c d e
1 1 1 1 1 1 1 1 1 1
...@@ -17,7 +17,7 @@ a b c d e ...@@ -17,7 +17,7 @@ a b c d e
7 7 7 7 7 7 7 7 7 7
explain select * From z1 order by a desc; explain select * From z1 order by a desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE z1 index NULL a 5 NULL 7 1 SIMPLE z1 index NULL a 5 NULL 7 Using index
select * from z1 order by a desc; select * from z1 order by a desc;
a b c d e a b c d e
7 7 7 7 7 7 7 7 7 7
......
...@@ -1041,6 +1041,6 @@ t CREATE TABLE `t` ( ...@@ -1041,6 +1041,6 @@ t CREATE TABLE `t` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join * from s,t where s.b = t.b; explain select straight_join * from s,t where s.b = t.b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b b 5 NULL 1000 Using where 1 SIMPLE s index b b 5 NULL 1000 Using where; Using index
1 SIMPLE t ref b b 5 test.s.b 11 1 SIMPLE t ref b b 5 test.s.b 11 Using index
drop table s,t; drop table s,t;
...@@ -1065,8 +1065,8 @@ t CREATE TABLE `t` ( ...@@ -1065,8 +1065,8 @@ t CREATE TABLE `t` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join * from s,t where s.b = t.b; explain select straight_join * from s,t where s.b = t.b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b,b_2 b_2 5 NULL 1000 Using where 1 SIMPLE s index b,b_2 b_2 5 NULL 1000 Using where; Using index
1 SIMPLE t ref b,b_2 b_2 5 test.s.b 11 1 SIMPLE t ref b,b_2 b_2 5 test.s.b 11 Using index
alter table s drop key b; alter table s drop key b;
alter table t drop key b; alter table t drop key b;
show create table s; show create table s;
...@@ -1087,8 +1087,8 @@ t CREATE TABLE `t` ( ...@@ -1087,8 +1087,8 @@ t CREATE TABLE `t` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join * from s,t where s.b = t.b; explain select straight_join * from s,t where s.b = t.b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b_2 b_2 5 NULL 1000 Using where 1 SIMPLE s index b_2 b_2 5 NULL 1000 Using where; Using index
1 SIMPLE t ref b_2 b_2 5 test.s.b 11 1 SIMPLE t ref b_2 b_2 5 test.s.b 11 Using index
alter table s add key(b); alter table s add key(b);
alter table t add key(b); alter table t add key(b);
show create table s; show create table s;
...@@ -1111,6 +1111,6 @@ t CREATE TABLE `t` ( ...@@ -1111,6 +1111,6 @@ t CREATE TABLE `t` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join * from s,t where s.b = t.b; explain select straight_join * from s,t where s.b = t.b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b_2,b b_2 5 NULL 1000 Using where 1 SIMPLE s index b_2,b b_2 5 NULL 1000 Using where; Using index
1 SIMPLE t ref b_2,b b_2 5 test.s.b 11 1 SIMPLE t ref b_2,b b_2 5 test.s.b 11 Using index
drop table s,t; drop table s,t;
...@@ -1115,6 +1115,6 @@ t CREATE TABLE `t` ( ...@@ -1115,6 +1115,6 @@ t CREATE TABLE `t` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join s.a,t.a from s,t where s.b = t.b; explain select straight_join s.a,t.a from s,t where s.b = t.b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b,b_3 b_3 5 NULL 1000 Using where 1 SIMPLE s index b,b_3 b_3 5 NULL 1000 Using where; Using index
1 SIMPLE t ref b,b_3 b_3 5 test.s.b 11 1 SIMPLE t ref b,b_3 b_3 5 test.s.b 11 Using index
drop table s,t; drop table s,t;
...@@ -1096,7 +1096,7 @@ u CREATE TABLE `u` ( ...@@ -1096,7 +1096,7 @@ u CREATE TABLE `u` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select straight_join * from s,t,u where s.b = t.b and s.c = u.c; explain select straight_join * from s,t,u where s.b = t.b and s.c = u.c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s index b,b_2 b_2 5 NULL 1000 Using where 1 SIMPLE s ALL b,b_2 NULL NULL NULL 1000 Using where
1 SIMPLE t ref b,b_2 b_2 5 test.s.b 11 1 SIMPLE t ref b,b_2 b_2 5 test.s.b 11 Using index
1 SIMPLE u ref c,c_2 c_2 5 test.s.c 11 1 SIMPLE u ref c,c_2 c_2 5 test.s.c 11 Using index
drop table s,t,u; drop table s,t,u;
...@@ -13,7 +13,7 @@ a b c d ...@@ -13,7 +13,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 40 400 4000 4 40 400 4000
...@@ -74,7 +74,7 @@ a b c d ...@@ -74,7 +74,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
6 60 600 6000 6 60 600 6000
...@@ -122,7 +122,7 @@ a b c d ...@@ -122,7 +122,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
6 60 600 6000 6 60 600 6000
...@@ -147,7 +147,7 @@ a ...@@ -147,7 +147,7 @@ a
9 9
explain select a,b from t1 where b > 30; explain select a,b from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select a,b from t1 where b > 30; select a,b from t1 where b > 30;
a b a b
6 60 6 60
...@@ -174,7 +174,7 @@ a b c d ...@@ -174,7 +174,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
9 90 900 9000 9 90 900 9000
...@@ -192,7 +192,7 @@ a ...@@ -192,7 +192,7 @@ a
9 9
explain select a,b from t1 where b > 30; explain select a,b from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select a,b from t1 where b > 30; select a,b from t1 where b > 30;
a b a b
9 90 9 90
......
...@@ -26,7 +26,7 @@ a b c d ...@@ -26,7 +26,7 @@ a b c d
8 80 800 8000 8 80 800 8000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 1000 1 10 100 1000
...@@ -49,7 +49,7 @@ a b c d ...@@ -49,7 +49,7 @@ a b c d
7 70 700 7000 7 70 700 7000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 1000 1 10 100 1000
...@@ -67,7 +67,7 @@ a b c d ...@@ -67,7 +67,7 @@ a b c d
3 30 300 3000 3 30 300 3000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 1000 1 10 100 1000
...@@ -78,29 +78,29 @@ create table t1(a int, b int, c int, d int, key(b) clustering=yes)engine=tokudb; ...@@ -78,29 +78,29 @@ create table t1(a int, b int, c int, d int, key(b) clustering=yes)engine=tokudb;
insert 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); insert 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);
select * from t1; select * from t1;
a b c d a b c d
1 10 100 1000
2 20 200 2000 2 20 200 2000
3 30 300 3000
4 40 400 4000 4 40 400 4000
1 10 100 1000
5 50 500 5000 5 50 500 5000
6 60 600 6000 6 60 600 6000
7 70 700 7000 7 70 700 7000
8 80 800 8000 8 80 800 8000
3 30 300 3000
9 90 900 9000 9 90 900 9000
delete from t1 where d > 8000; delete from t1 where d > 8000;
select * from t1; select * from t1;
a b c d a b c d
1 10 100 1000
2 20 200 2000 2 20 200 2000
3 30 300 3000
4 40 400 4000 4 40 400 4000
1 10 100 1000
5 50 500 5000 5 50 500 5000
6 60 600 6000 6 60 600 6000
7 70 700 7000 7 70 700 7000
8 80 800 8000 8 80 800 8000
3 30 300 3000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 1000 1 10 100 1000
...@@ -114,12 +114,12 @@ a b c d ...@@ -114,12 +114,12 @@ a b c d
delete from t1 where b > 30; delete from t1 where b > 30;
select * from t1; select * from t1;
a b c d a b c d
2 20 200 2000
1 10 100 1000 1 10 100 1000
2 20 200 2000
3 30 300 3000 3 30 300 3000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 1000 1 10 100 1000
......
...@@ -9,7 +9,7 @@ insert into t1 values (4,40,400,4000,40000,400000); ...@@ -9,7 +9,7 @@ insert into t1 values (4,40,400,4000,40000,400000);
insert into t1 values (5,50,500,5000,50000,500000); insert into t1 values (5,50,500,5000,50000,500000);
explain select * from t1 where c > 0; explain select * from t1 where c > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY b NULL NULL NULL; Using where; Using index
select * from t1 where c > 0; select * from t1 where c > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -19,7 +19,7 @@ a b c d e f ...@@ -19,7 +19,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -29,7 +29,7 @@ a b c d e f ...@@ -29,7 +29,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -71,7 +71,7 @@ e f ...@@ -71,7 +71,7 @@ e f
update t1 set a = a+1, b = b+10; update t1 set a = a+1, b = b+10;
explain select * from t1 where c > 0; explain select * from t1 where c > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY b NULL NULL NULL; Using where; Using index
select * from t1 where c > 0; select * from t1 where c > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -81,7 +81,7 @@ a b c d e f ...@@ -81,7 +81,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -91,7 +91,7 @@ a b c d e f ...@@ -91,7 +91,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -140,14 +140,14 @@ a b c d e f ...@@ -140,14 +140,14 @@ a b c d e f
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d; ...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d;
alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes; alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes;
explain select * from t1 where c > 0; explain select * from t1 where c > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY d NULL NULL NULL; Using where; Using index
select * from t1 where c > 0; select * from t1 where c > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
......
...@@ -9,7 +9,7 @@ insert into t1 values (4,40,400,4000,40000,400000); ...@@ -9,7 +9,7 @@ insert into t1 values (4,40,400,4000,40000,400000);
insert into t1 values (5,50,500,5000,50000,500000); insert into t1 values (5,50,500,5000,50000,500000);
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -19,7 +19,7 @@ a b c d e f ...@@ -19,7 +19,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -29,7 +29,7 @@ a b c d e f ...@@ -29,7 +29,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -71,7 +71,7 @@ e f ...@@ -71,7 +71,7 @@ e f
update t1 set a = a+1, b = b+10; update t1 set a = a+1, b = b+10;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -81,7 +81,7 @@ a b c d e f ...@@ -81,7 +81,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -91,7 +91,7 @@ a b c d e f ...@@ -91,7 +91,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -133,21 +133,21 @@ e f ...@@ -133,21 +133,21 @@ e f
delete from t1 where b > 35; delete from t1 where b > 35;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d; ...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d;
alter table t1 add key b(b) clustering=yes, add index d(d,a) clustering=yes; alter table t1 add key b(b) clustering=yes, add index d(d,a) clustering=yes;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > 0; explain select * from t1 where d > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > 0; select * from t1 where d > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
......
...@@ -9,7 +9,7 @@ insert into t1 values ("4","40","400","4000","40000","400000"); ...@@ -9,7 +9,7 @@ insert into t1 values ("4","40","400","4000","40000","400000");
insert into t1 values ("5","50","500","5000","50000","500000"); insert into t1 values ("5","50","500","5000","50000","500000");
explain select * from t1 where c > "0"; explain select * from t1 where c > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY b NULL NULL NULL; Using where; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -19,7 +19,7 @@ a b c d e f ...@@ -19,7 +19,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -29,7 +29,7 @@ a b c d e f ...@@ -29,7 +29,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -71,7 +71,7 @@ e f ...@@ -71,7 +71,7 @@ e f
update t1 set a = a+1, b = b+10; update t1 set a = a+1, b = b+10;
explain select * from t1 where c > "0"; explain select * from t1 where c > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY b NULL NULL NULL; Using where; Using index
select * from t1 where c > "0"; select * from t1 where c > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -81,7 +81,7 @@ a b c d e f ...@@ -81,7 +81,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -91,7 +91,7 @@ a b c d e f ...@@ -91,7 +91,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -140,14 +140,14 @@ a b c d e f ...@@ -140,14 +140,14 @@ a b c d e f
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d; ...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d;
alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes; alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes;
explain select * from t1 where c > "0"; explain select * from t1 where c > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY NULL NULL NULL; Using where 1 SIMPLE t1 index PRIMARY d NULL NULL NULL; Using where; Using index
select * from t1 where c > "0"; select * from t1 where c > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
......
...@@ -9,7 +9,7 @@ insert into t1 values (4,40,"400","4000","40000",400000); ...@@ -9,7 +9,7 @@ insert into t1 values (4,40,"400","4000","40000",400000);
insert into t1 values (5,50,"500","5000","50000",500000); insert into t1 values (5,50,"500","5000","50000",500000);
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -19,7 +19,7 @@ a b c d e f ...@@ -19,7 +19,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -29,7 +29,7 @@ a b c d e f ...@@ -29,7 +29,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -71,7 +71,7 @@ e f ...@@ -71,7 +71,7 @@ e f
update t1 set a = a+1, b = b+10; update t1 set a = a+1, b = b+10;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -81,7 +81,7 @@ a b c d e f ...@@ -81,7 +81,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -91,7 +91,7 @@ a b c d e f ...@@ -91,7 +91,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -133,21 +133,21 @@ e f ...@@ -133,21 +133,21 @@ e f
delete from t1 where b > 35; delete from t1 where b > 35;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d; ...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d;
alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes; alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL d NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > 0; explain select * from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > 0; select * from t1 where b > 0;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
......
...@@ -9,7 +9,7 @@ insert into t1 values ("4","40","400","4000","40000","400000"); ...@@ -9,7 +9,7 @@ insert into t1 values ("4","40","400","4000","40000","400000");
insert into t1 values ("5","50","500","5000","50000","500000"); insert into t1 values ("5","50","500","5000","50000","500000");
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -19,7 +19,7 @@ a b c d e f ...@@ -19,7 +19,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -29,7 +29,7 @@ a b c d e f ...@@ -29,7 +29,7 @@ a b c d e f
5 50 500 5000 50000 500000 5 50 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
1 10 100 1000 10000 100000 1 10 100 1000 10000 100000
...@@ -71,7 +71,7 @@ e f ...@@ -71,7 +71,7 @@ e f
update t1 set a = a+1, b = b+10; update t1 set a = a+1, b = b+10;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -81,7 +81,7 @@ a b c d e f ...@@ -81,7 +81,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -91,7 +91,7 @@ a b c d e f ...@@ -91,7 +91,7 @@ a b c d e f
6 60 500 5000 50000 500000 6 60 500 5000 50000 500000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -133,21 +133,21 @@ e f ...@@ -133,21 +133,21 @@ e f
delete from t1 where b > 35; delete from t1 where b > 35;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL b NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d; ...@@ -175,21 +175,21 @@ alter table t1 drop index b, drop index d;
alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes; alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes;
explain select * from t1; explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; 1 SIMPLE t1 index NULL d NULL NULL NULL; Using index
select * from t1; select * from t1;
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where b > "0"; explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b NULL NULL NULL; Using where 1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0"; select * from t1 where b > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
3 30 200 2000 20000 200000 3 30 200 2000 20000 200000
explain select * from t1 where d > "0"; explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range d d NULL NULL NULL; Using where 1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0"; select * from t1 where d > "0";
a b c d e f a b c d e f
2 20 100 1000 10000 100000 2 20 100 1000 10000 100000
......
...@@ -13,7 +13,7 @@ a b c d ...@@ -13,7 +13,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 40 400 4000 4 40 400 4000
...@@ -69,7 +69,7 @@ a b c d ...@@ -69,7 +69,7 @@ a b c d
10 10 10 10 10 10 10 10
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 40 400 4000 4 40 400 4000
...@@ -117,7 +117,7 @@ a b c d e ...@@ -117,7 +117,7 @@ a b c d e
10 10 10 10 NULL 10 10 10 10 NULL
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d e a b c d e
4 40 400 4000 NULL 4 40 400 4000 NULL
...@@ -171,7 +171,7 @@ a b c d e ...@@ -171,7 +171,7 @@ a b c d e
10 10 10 10 NULL 10 10 10 10 NULL
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d e a b c d e
4 40 400 4000 NULL 4 40 400 4000 NULL
......
...@@ -4,7 +4,7 @@ create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=ye ...@@ -4,7 +4,7 @@ create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=ye
insert into t1 values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),(7,7,7,7),(8,8,8,8),(9,9,9,9); insert into t1 values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),(7,7,7,7),(8,8,8,8),(9,9,9,9);
explain select * from t1 where b > 2; explain select * from t1 where b > 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
explain select * from t1 where c > 2; explain select * from t1 where c > 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where 1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
...@@ -16,7 +16,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -16,7 +16,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL NULL; Using where 1 SIMPLE t1 range c c 5 NULL NULL; Using where
explain select * from t1 where b > 7; explain select * from t1 where b > 7;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
explain select a from t1 where b > 0; explain select a from t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
......
...@@ -13,7 +13,7 @@ a b c d ...@@ -13,7 +13,7 @@ a b c d
9 90 900 9000 9 90 900 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 40 400 4000 4 40 400 4000
...@@ -65,7 +65,7 @@ a b c d ...@@ -65,7 +65,7 @@ a b c d
9 95 905 9000 9 95 905 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 45 405 4000 4 45 405 4000
...@@ -76,7 +76,7 @@ a b c d ...@@ -76,7 +76,7 @@ a b c d
9 95 905 9000 9 95 905 9000
explain select * from t1 where c > 750; explain select * from t1 where c > 750;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL NULL; Using where 1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
select * from t1 where c > 750; select * from t1 where c > 750;
a b c d a b c d
8 85 805 8000 8 85 805 8000
...@@ -100,7 +100,7 @@ a b ...@@ -100,7 +100,7 @@ a b
9 95 9 95
explain select a,b from t1 where c > 750; explain select a,b from t1 where c > 750;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL NULL; Using where 1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
select a,c from t1 where c > 750; select a,c from t1 where c > 750;
a c a c
8 805 8 805
...@@ -117,7 +117,7 @@ a b c d ...@@ -117,7 +117,7 @@ a b c d
9 95 905 9000 9 95 905 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 45 405 4000 4 45 405 4000
...@@ -144,7 +144,7 @@ a ...@@ -144,7 +144,7 @@ a
9 9
explain select a,b from t1 where b > 30; explain select a,b from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select a,b from t1 where b > 30; select a,b from t1 where b > 30;
a b a b
4 45 4 45
...@@ -183,7 +183,7 @@ a b c d ...@@ -183,7 +183,7 @@ a b c d
9 100 910 9000 9 100 910 9000
explain select * from t1 where b > 30; explain select * from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select * from t1 where b > 30; select * from t1 where b > 30;
a b c d a b c d
4 50 410 4000 4 50 410 4000
...@@ -194,7 +194,7 @@ a b c d ...@@ -194,7 +194,7 @@ a b c d
9 100 910 9000 9 100 910 9000
explain select * from t1 where c > 750; explain select * from t1 where c > 750;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL NULL; Using where 1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
select * from t1 where c > 750; select * from t1 where c > 750;
a b c d a b c d
8 90 810 8000 8 90 810 8000
...@@ -210,7 +210,7 @@ a ...@@ -210,7 +210,7 @@ a
9 9
explain select a,b from t1 where b > 30; explain select a,b from t1 where b > 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 range b b 5 NULL NULL; Using where; Using index
select a,b from t1 where b > 30; select a,b from t1 where b > 30;
a b a b
4 50 4 50
...@@ -221,7 +221,7 @@ a b ...@@ -221,7 +221,7 @@ a b
9 100 9 100
explain select a,b from t1 where c > 750; explain select a,b from t1 where c > 750;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL NULL; Using where 1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
select a,c from t1 where c > 750; select a,c from t1 where c > 750;
a c a c
8 810 8 810
......
...@@ -27,7 +27,7 @@ a b c d ...@@ -27,7 +27,7 @@ a b c d
9 90 900 19000 9 90 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 11000 1 10 100 11000
...@@ -53,7 +53,7 @@ a b c d ...@@ -53,7 +53,7 @@ a b c d
10009 90 900 19000 10009 90 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
10001 10 100 11000 10001 10 100 11000
...@@ -79,7 +79,7 @@ a b c d ...@@ -79,7 +79,7 @@ a b c d
10009 10090 900 19000 10009 10090 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
10001 10010 100 11000 10001 10010 100 11000
...@@ -96,30 +96,30 @@ create table t1(a int, b int, c int, d int, key(b) clustering=yes)engine=tokudb; ...@@ -96,30 +96,30 @@ create table t1(a int, b int, c int, d int, key(b) clustering=yes)engine=tokudb;
insert 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); insert 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);
select * from t1; select * from t1;
a b c d a b c d
1 10 100 1000
2 20 200 2000 2 20 200 2000
3 30 300 3000
4 40 400 4000 4 40 400 4000
1 10 100 1000
5 50 500 5000 5 50 500 5000
6 60 600 6000 6 60 600 6000
7 70 700 7000 7 70 700 7000
8 80 800 8000 8 80 800 8000
3 30 300 3000
9 90 900 9000 9 90 900 9000
update t1 set d=d+10000; update t1 set d=d+10000;
select * from t1; select * from t1;
a b c d a b c d
1 10 100 11000
2 20 200 12000 2 20 200 12000
3 30 300 13000
4 40 400 14000 4 40 400 14000
1 10 100 11000
5 50 500 15000 5 50 500 15000
6 60 600 16000 6 60 600 16000
7 70 700 17000 7 70 700 17000
8 80 800 18000 8 80 800 18000
3 30 300 13000
9 90 900 19000 9 90 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10 100 11000 1 10 100 11000
...@@ -134,18 +134,18 @@ a b c d ...@@ -134,18 +134,18 @@ a b c d
update t1 set b=b+10000; update t1 set b=b+10000;
select * from t1; select * from t1;
a b c d a b c d
1 10010 100 11000
2 10020 200 12000 2 10020 200 12000
3 10030 300 13000
4 10040 400 14000 4 10040 400 14000
1 10010 100 11000
5 10050 500 15000 5 10050 500 15000
6 10060 600 16000 6 10060 600 16000
7 10070 700 17000 7 10070 700 17000
8 10080 800 18000 8 10080 800 18000
3 10030 300 13000
9 10090 900 19000 9 10090 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10010 100 11000 1 10010 100 11000
...@@ -161,18 +161,18 @@ alter table t1 drop key b; ...@@ -161,18 +161,18 @@ alter table t1 drop key b;
alter table t1 add key b(b) clustering=yes; alter table t1 add key b(b) clustering=yes;
select * from t1; select * from t1;
a b c d a b c d
1 10010 100 11000
2 10020 200 12000 2 10020 200 12000
3 10030 300 13000
4 10040 400 14000 4 10040 400 14000
1 10010 100 11000
5 10050 500 15000 5 10050 500 15000
6 10060 600 16000 6 10060 600 16000
7 10070 700 17000 7 10070 700 17000
8 10080 800 18000 8 10080 800 18000
3 10030 300 13000
9 10090 900 19000 9 10090 900 19000
explain select * From t1 where b > 0; explain select * From t1 where b > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 5 NULL NULL; Using where 1 SIMPLE t1 index b b 5 NULL NULL; Using where; Using index
select * From t1 where b > 0; select * From t1 where b > 0;
a b c d a b c d
1 10010 100 11000 1 10010 100 11000
......
...@@ -11,7 +11,7 @@ insert into foo values (4,40,400); ...@@ -11,7 +11,7 @@ insert into foo values (4,40,400);
alter table foo add column z int default 999 first; alter table foo add column z int default 999 first;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4 1 SIMPLE foo index NULL b 5 NULL 4 Using index
select * from foo; select * from foo;
z a b c z a b c
999 1 10 100 999 1 10 100
...@@ -20,7 +20,7 @@ z a b c ...@@ -20,7 +20,7 @@ z a b c
999 4 40 400 999 4 40 400
explain select * from foo where b > 20; explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where 1 SIMPLE foo range b b 5 NULL 2 Using where; Using index
select* from foo where b > 10; select* from foo where b > 10;
z a b c z a b c
999 2 20 200 999 2 20 200
...@@ -31,7 +31,7 @@ begin; ...@@ -31,7 +31,7 @@ begin;
alter table foo drop column z; alter table foo drop column z;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4 1 SIMPLE foo index NULL b 5 NULL 4 Using index
select * from foo; select * from foo;
a b c a b c
1 10 100 1 10 100
...@@ -40,7 +40,7 @@ a b c ...@@ -40,7 +40,7 @@ a b c
4 40 400 4 40 400
explain select * from foo where b > 20; explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where 1 SIMPLE foo range b b 5 NULL 2 Using where; Using index
select* from foo where b > 10; select* from foo where b > 10;
a b c a b c
2 20 200 2 20 200
...@@ -50,7 +50,7 @@ lock tables foo write; ...@@ -50,7 +50,7 @@ lock tables foo write;
alter table foo add column z int; alter table foo add column z int;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4 1 SIMPLE foo index NULL b 5 NULL 4 Using index
select * from foo; select * from foo;
a b c z a b c z
1 10 100 NULL 1 10 100 NULL
...@@ -59,7 +59,7 @@ a b c z ...@@ -59,7 +59,7 @@ a b c z
4 40 400 NULL 4 40 400 NULL
explain select * from foo where b > 20; explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where 1 SIMPLE foo range b b 5 NULL 2 Using where; Using index
select* from foo where b > 10; select* from foo where b > 10;
a b c z a b c z
2 20 200 NULL 2 20 200 NULL
...@@ -87,21 +87,21 @@ select* from foo where b > 10; ...@@ -87,21 +87,21 @@ select* from foo where b > 10;
end | end |
call p0(); call p0();
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4 1 SIMPLE foo index NULL b 5 NULL 4 Using index
a b c a b c
1 10 100 1 10 100
2 20 200 2 20 200
3 30 300 3 30 300
4 40 400 4 40 400
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where 1 SIMPLE foo range b b 5 NULL 2 Using where; Using index
a b c a b c
2 20 200 2 20 200
3 30 300 3 30 300
4 40 400 4 40 400
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 4 1 SIMPLE foo index NULL b 5 NULL 4 Using index
select * from foo; select * from foo;
a b c a b c
1 10 100 1 10 100
...@@ -110,7 +110,7 @@ a b c ...@@ -110,7 +110,7 @@ a b c
4 40 400 4 40 400
explain select * from foo where b > 20; explain select * from foo where b > 20;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 2 Using where 1 SIMPLE foo range b b 5 NULL 2 Using where; Using index
select* from foo where b > 10; select* from foo where b > 10;
a b c a b c
2 20 200 2 20 200
...@@ -141,7 +141,7 @@ a b c ...@@ -141,7 +141,7 @@ a b c
4 40 400 4 40 400
5 50 500 5 50 500
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5 1 SIMPLE foo index NULL b 5 NULL 5 Using index
a b c g a b c g
1 10 100 NULL 1 10 100 NULL
2 20 200 NULL 2 20 200 NULL
...@@ -154,11 +154,11 @@ a b c g ...@@ -154,11 +154,11 @@ a b c g
4 40 400 NULL 4 40 400 NULL
5 50 500 NULL 5 50 500 NULL
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 3 Using where 1 SIMPLE foo range b b 5 NULL 3 Using where; Using index
set autocommit=on; set autocommit=on;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5 1 SIMPLE foo index NULL b 5 NULL 5 Using index
select * from foo; select * from foo;
a b c g a b c g
1 10 100 NULL 1 10 100 NULL
...@@ -168,7 +168,7 @@ a b c g ...@@ -168,7 +168,7 @@ a b c g
5 50 500 NULL 5 50 500 NULL
explain select * from foo where b > 10; explain select * from foo where b > 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range b b 5 NULL 4 Using where 1 SIMPLE foo range b b 5 NULL 4 Using where; Using index
select * from foo where b > 10; select * from foo where b > 10;
a b c g a b c g
2 20 200 NULL 2 20 200 NULL
......
...@@ -24,7 +24,7 @@ aa b c d e ...@@ -24,7 +24,7 @@ aa b c d e
1 10 cc dddd eeeee 1 10 cc dddd eeeee
explain select * from foo where aa > 0; explain select * from foo where aa > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 1 Using where 1 SIMPLE foo index PRIMARY d 13 NULL 1 Using where; Using index
select * from foo where aa > 0; select * from foo where aa > 0;
aa b c d e aa b c d e
1 10 cc dddd eeeee 1 10 cc dddd eeeee
...@@ -62,7 +62,7 @@ foo CREATE TABLE `foo` ( ...@@ -62,7 +62,7 @@ foo CREATE TABLE `foo` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 ) ENGINE=TokuDB DEFAULT CHARSET=latin1
explain select * from foo where dd > "d"; explain select * from foo where dd > "d";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range d d 13 NULL 1 Using where 1 SIMPLE foo index d d 13 NULL 1 Using where; Using index
select * from foo where dd > "d"; select * from foo where dd > "d";
aa bb c dd e aa bb c dd e
1 10 cc dddd eeeee 1 10 cc dddd eeeee
......
...@@ -9,7 +9,7 @@ insert into foo values (4,"four"); ...@@ -9,7 +9,7 @@ insert into foo values (4,"four");
alter table foo add key a(a) clustering=yes; alter table foo add key a(a) clustering=yes;
explain select * From foo where a > 0; explain select * From foo where a > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range a a 5 NULL NULL; Using where 1 SIMPLE foo index a a 5 NULL NULL; Using where; Using index
select * From foo where a > 0; select * From foo where a > 0;
a b a b
1 one 1 one
......
...@@ -4,7 +4,7 @@ create table foo (a int, b int, c int, key (a) clustering=yes)engine=tokudb; ...@@ -4,7 +4,7 @@ create table foo (a int, b int, c int, key (a) clustering=yes)engine=tokudb;
insert into foo values (1,1,1),(1,2,2),(1,3,3),(2,1,4),(2,2,5),(2,3,6),(3,1,7),(3,2,8); insert into foo values (1,1,1),(1,2,2),(1,3,3),(2,1,4),(2,2,5),(2,3,6),(3,1,7),(3,2,8);
explain select * From foo where a = 2; explain select * From foo where a = 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ref a a 5 const NULL; 1 SIMPLE foo ref a a 5 const NULL; Using index
select * From foo where a = 2; select * From foo where a = 2;
a b c a b c
2 1 4 2 1 4
......
...@@ -10,13 +10,13 @@ insert into t1 values (1,1),(2,2),(3,3); ...@@ -10,13 +10,13 @@ insert into t1 values (1,1),(2,2),(3,3);
insert into t2 values (1),(2),(3); insert into t2 values (1),(2),(3);
explain select t1.* from t1 left join t2 using(f1) group by t1.f1; explain select t1.* from t1 left join t2 using(f1) group by t1.f1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL NA 1 SIMPLE t1 ALL NULL NULL NULL NULL NA Using temporary; Using filesort
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 NA Using index 1 SIMPLE t2 ref f1 f1 4 test.t1.f1 NA Using index
alter table t1 drop primary key; alter table t1 drop primary key;
alter table t1 add index (f1) clustering=yes; alter table t1 add index (f1) clustering=yes;
explain select t1.* from t1 left join t2 using(f1) group by t1.f1; explain select t1.* from t1 left join t2 using(f1) group by t1.f1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL f1 4 NULL NA 1 SIMPLE t1 index NULL f1 4 NULL NA Using index
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 NA Using index 1 SIMPLE t2 ref f1 f1 4 test.t1.f1 NA Using index
drop table t1,t2; drop table t1,t2;
# #
...@@ -4,14 +4,14 @@ create table foo (a int, b int, c int, primary key (a), key (b) clustering=yes); ...@@ -4,14 +4,14 @@ create table foo (a int, b int, c int, primary key (a), key (b) clustering=yes);
replace into foo values (1,10,100), (2,20,200), (1,10,1000); replace into foo values (1,10,100), (2,20,200), (1,10,1000);
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 2 1 SIMPLE foo index NULL b 5 NULL 2 Using index
select * from foo; select * from foo;
a b c a b c
1 10 1000 1 10 1000
2 20 200 2 20 200
explain select * from foo order by b desc; explain select * from foo order by b desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 2 1 SIMPLE foo index NULL b 5 NULL 2 Using index
select * from foo order by b desc; select * from foo order by b desc;
a b c a b c
2 20 200 2 20 200
...@@ -21,7 +21,7 @@ Warnings: ...@@ -21,7 +21,7 @@ Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY' Warning 1062 Duplicate entry '1' for key 'PRIMARY'
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 3 1 SIMPLE foo index NULL b 5 NULL 3 Using index
select * from foo; select * from foo;
a b c a b c
1 10 1000 1 10 1000
...@@ -29,7 +29,7 @@ a b c ...@@ -29,7 +29,7 @@ a b c
3 30 300 3 30 300
explain select * from foo order by b desc; explain select * from foo order by b desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 3 1 SIMPLE foo index NULL b 5 NULL 3 Using index
select * from foo order by b desc; select * from foo order by b desc;
a b c a b c
3 30 300 3 30 300
......
...@@ -5,10 +5,10 @@ create table foo (a int, b int, c int, d int, primary key (a), key (b), key (c) ...@@ -5,10 +5,10 @@ create table foo (a int, b int, c int, d int, primary key (a), key (b), key (c)
insert into foo values (1,100,1000,1),(2,20,200,2),(3,300,30,3),(4,4,4,4); insert into foo values (1,100,1000,1),(2,20,200,2),(3,300,30,3),(4,4,4,4);
select * from foo; select * from foo;
a b c d a b c d
1 100 1000 1
2 20 200 2
3 300 30 3
4 4 4 4 4 4 4 4
3 300 30 3
2 20 200 2
1 100 1000 1
explain select b,a from foo; explain select b,a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index 1 SIMPLE foo index NULL b 5 NULL 4 Using index
...@@ -30,10 +30,10 @@ a b c d ...@@ -30,10 +30,10 @@ a b c d
update foo set d=d+100; update foo set d=d+100;
select * from foo; select * from foo;
a b c d a b c d
1 100 1000 101
2 20 200 102
3 300 30 103
4 4 4 104 4 4 4 104
3 300 30 103
2 20 200 102
1 100 1000 101
explain select b,a from foo; explain select b,a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index 1 SIMPLE foo index NULL b 5 NULL 4 Using index
...@@ -55,10 +55,10 @@ a b c d ...@@ -55,10 +55,10 @@ a b c d
update foo set b=b+1; update foo set b=b+1;
select * from foo; select * from foo;
a b c d a b c d
1 101 1000 101
2 21 200 102
3 301 30 103
4 5 4 104 4 5 4 104
3 301 30 103
2 21 200 102
1 101 1000 101
explain select b,a from foo; explain select b,a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index 1 SIMPLE foo index NULL b 5 NULL 4 Using index
...@@ -80,10 +80,10 @@ a b c d ...@@ -80,10 +80,10 @@ a b c d
update foo set c=c*10; update foo set c=c*10;
select * from foo; select * from foo;
a b c d a b c d
1 101 10000 101
2 21 2000 102
3 301 300 103
4 5 40 104 4 5 40 104
3 301 300 103
2 21 2000 102
1 101 10000 101
explain select b,a from foo; explain select b,a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL b 5 NULL 4 Using index 1 SIMPLE foo index NULL b 5 NULL 4 Using index
......
...@@ -6,7 +6,7 @@ insert into foo values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5); ...@@ -6,7 +6,7 @@ insert into foo values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
# Both explains should use primary key; # Both explains should use primary key;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5 1 SIMPLE foo index NULL b 5 NULL 5 Using index
explain select a from foo; explain select a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL PRIMARY 4 NULL 5 Using index 1 SIMPLE foo index NULL PRIMARY 4 NULL 5 Using index
...@@ -16,7 +16,7 @@ insert into foo values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5); ...@@ -16,7 +16,7 @@ insert into foo values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
# Both explains should use primary key; # Both explains should use primary key;
explain select * from foo; explain select * from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ALL NULL NULL NULL NULL 5 1 SIMPLE foo index NULL b 5 NULL 5 Using index
explain select a from foo; explain select a from foo;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo index NULL PRIMARY 4 NULL 5 Using index 1 SIMPLE foo index NULL PRIMARY 4 NULL 5 Using index
......
...@@ -62,7 +62,7 @@ c ...@@ -62,7 +62,7 @@ c
600 600
explain select * from foo where c > 300; explain select * from foo where c > 300;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range c c 5 NULL 3 Using where 1 SIMPLE foo range c c 5 NULL 3 Using where; Using index
select * from foo where c > 300; select * from foo where c > 300;
a b c a b c
4 40 400 4 40 400
......
...@@ -73,14 +73,14 @@ alter table foo drop primary key; ...@@ -73,14 +73,14 @@ alter table foo drop primary key;
alter table foo add index clst_a(a,b) clustering=yes; alter table foo add index clst_a(a,b) clustering=yes;
explain select * from foo where a=4; explain select * from foo where a=4;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ref clst_a clst_a 4 const NULL; 1 SIMPLE foo ref clst_a clst_a 4 const NULL; Using index
select * from foo where a=4; select * from foo where a=4;
a b c a b c
4 40 400 4 40 400
4 400 400 4 400 400
explain select * from foo where a>4; explain select * from foo where a>4;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where 1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where; Using index
select * from foo where a>4; select * from foo where a>4;
a b c a b c
5 50 500 5 50 500
...@@ -89,7 +89,7 @@ a b c ...@@ -89,7 +89,7 @@ a b c
6 600 600 6 600 600
explain select * from foo where a<3 order by a desc; explain select * from foo where a<3 order by a desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where 1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where; Using index
select * from foo where a<3 order by a desc; select * from foo where a<3 order by a desc;
a b c a b c
2 200 200 2 200 200
...@@ -98,7 +98,7 @@ a b c ...@@ -98,7 +98,7 @@ a b c
1 10 100 1 10 100
explain select * from foo where a>=4; explain select * from foo where a>=4;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where 1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where; Using index
select * from foo where a>=4; select * from foo where a>=4;
a b c a b c
4 40 400 4 40 400
...@@ -109,7 +109,7 @@ a b c ...@@ -109,7 +109,7 @@ a b c
6 600 600 6 600 600
explain select * from foo where a<=2 order by a desc; explain select * from foo where a<=2 order by a desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where 1 SIMPLE foo range clst_a clst_a 4 NULL NULL; Using where; Using index
select * from foo where a<=2 order by a desc; select * from foo where a<=2 order by a desc;
a b c a b c
2 200 200 2 200 200
...@@ -118,7 +118,7 @@ a b c ...@@ -118,7 +118,7 @@ a b c
1 10 100 1 10 100
explain select * from foo where a=4 order by b desc; explain select * from foo where a=4 order by b desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE foo ref clst_a clst_a 4 const NULL; Using where 1 SIMPLE foo ref clst_a clst_a 4 const NULL; Using where; Using index
select * from foo where a=4 order by b desc; select * from foo where a=4 order by b desc;
a b c a b c
4 400 400 4 400 400
......
...@@ -24,7 +24,7 @@ a b c ...@@ -24,7 +24,7 @@ a b c
8 8 8 8 8 8
explain select a,c from t1 where a > 2; explain select a,c from t1 where a > 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 6 Using where 1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index
explain select b,c from t1 where b > 2; explain select b,c from t1 where b > 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where 1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment