Commit 7a213643 authored by Sergei Golubchik's avatar Sergei Golubchik

after-merge fix partitioning tests

* use --sort_result in test files as needed
* remove old and wrong mariadb-5.3 related partitioning hack
   from ha_tokudb.cc
parent 15f7f5c6
...@@ -8,11 +8,13 @@ partition pa3 max_rows=30 min_rows=4, ...@@ -8,11 +8,13 @@ partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64));
--sorted_result
select hex(a) from t1; select hex(a) from t1;
select a from t1 where substr(a,1,2)='b\0'; select a from t1 where substr(a,1,2)='b\0';
update t1 set a='cc' where substr(a,1,2)= 'b\0'; update t1 set a='cc' where substr(a,1,2)= 'b\0';
select a from t1 where substr(a,1,1)='c'; select a from t1 where substr(a,1,1)='c';
delete from t1 where substr(a,1,2)='cc'; delete from t1 where substr(a,1,2)='cc';
--sorted_result
select hex(a) from t1; select hex(a) from t1;
drop table t1; drop table t1;
...@@ -33,6 +35,7 @@ inc $letter; ...@@ -33,6 +35,7 @@ inc $letter;
commit; commit;
--enable_query_log --enable_query_log
select count(*) from t2; select count(*) from t2;
--sorted_result
select hex(a) from t2; select hex(a) from t2;
drop table t2; drop table t2;
......
...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4, ...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64));
--sorted_result
select * from t1; select * from t1;
select * from t1 where a='b'; select * from t1 where a='b';
update t1 set a='bb' where a='b'; update t1 set a='bb' where a='b';
delete from t1 where a='bb'; delete from t1 where a='bb';
--sorted_result
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -32,6 +34,7 @@ inc $letter; ...@@ -32,6 +34,7 @@ inc $letter;
commit; commit;
--enable_query_log --enable_query_log
select count(*) from t2; select count(*) from t2;
--sorted_result
select * from t2; select * from t2;
drop table t2; drop table t2;
......
...@@ -8,11 +8,13 @@ partition pa3 max_rows=30 min_rows=4, ...@@ -8,11 +8,13 @@ partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('A'),('D'),('L'),('G'); insert into t1 values ('A'),('D'),('L'),('G');
--sorted_result
select * from t1; select * from t1;
select * from t1 where a='A'; select * from t1 where a='A';
update t1 set a='E' where a='L'; update t1 set a='E' where a='L';
select * from t1; select * from t1;
delete from t1 where a='E'; delete from t1 where a='E';
--sorted_result
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -37,6 +39,7 @@ commit; ...@@ -37,6 +39,7 @@ commit;
--enable_query_log --enable_query_log
insert into t2 values ('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'),('0'); insert into t2 values ('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'),('0');
select count(*) from t2; select count(*) from t2;
--sorted_result
select * from t2; select * from t2;
drop table t2; drop table t2;
......
...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4, ...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64));
--sorted_result
select * from t1; select * from t1;
select * from t1 where a='b'; select * from t1 where a='b';
update t1 set a='bb' where a='b'; update t1 set a='bb' where a='b';
delete from t1 where a='bb'; delete from t1 where a='bb';
--sorted_result
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -32,6 +34,7 @@ inc $letter; ...@@ -32,6 +34,7 @@ inc $letter;
commit; commit;
--enable_query_log --enable_query_log
select count(*) from t2; select count(*) from t2;
--sorted_result
select * from t2; select * from t2;
drop table t2; drop table t2;
......
...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4, ...@@ -8,10 +8,12 @@ partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64));
--sorted_result
select * from t1; select * from t1;
select * from t1 where a='b'; select * from t1 where a='b';
update t1 set a='bb' where a='b'; update t1 set a='bb' where a='b';
delete from t1 where a='bb'; delete from t1 where a='bb';
--sorted_result
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -32,6 +34,7 @@ inc $letter; ...@@ -32,6 +34,7 @@ inc $letter;
commit; commit;
--enable_query_log --enable_query_log
select count(*) from t2; select count(*) from t2;
--sorted_result
select * from t2; select * from t2;
drop table t2; drop table t2;
......
...@@ -20013,6 +20013,7 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys) ...@@ -20013,6 +20013,7 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys)
min_cost= cost; min_cost= cost;
best=nr; best=nr;
} }
DBUG_ASSERT(best < MAX_KEY);
} }
} }
} }
......
...@@ -5786,9 +5786,6 @@ int ha_tokudb::info(uint flag) { ...@@ -5786,9 +5786,6 @@ int ha_tokudb::info(uint flag) {
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;
if (stats.records == 0) {
stats.records++;
}
stats.deleted = 0; stats.deleted = 0;
if (!(flag & HA_STATUS_NO_LOCK)) { if (!(flag & HA_STATUS_NO_LOCK)) {
uint64_t num_rows = 0; uint64_t num_rows = 0;
...@@ -5805,9 +5802,6 @@ int ha_tokudb::info(uint flag) { ...@@ -5805,9 +5802,6 @@ int ha_tokudb::info(uint flag) {
if (error == 0) { if (error == 0) {
share->rows = num_rows; share->rows = num_rows;
stats.records = num_rows; stats.records = num_rows;
if (stats.records == 0) {
stats.records++;
}
} }
else { else {
goto cleanup; goto cleanup;
...@@ -7197,7 +7191,7 @@ double ha_tokudb::read_time( ...@@ -7197,7 +7191,7 @@ double ha_tokudb::read_time(
// //
total_scan = scan_time(); total_scan = scan_time();
if (stats.records < rows) { if (stats.records <= rows) {
ret_val = is_clustering ? total_scan + 0.00001 : total_scan; ret_val = is_clustering ? total_scan + 0.00001 : total_scan;
goto cleanup; goto cleanup;
} }
......
...@@ -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; Using index 1 SIMPLE t1 index 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
...@@ -96,7 +96,7 @@ a ...@@ -96,7 +96,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; Using index 1 SIMPLE t1 index 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; Using index 1 SIMPLE t1 index 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; Using index 1 SIMPLE t1 index 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; Using index 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
...@@ -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; Using index 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
...@@ -100,7 +100,7 @@ a b c d ...@@ -100,7 +100,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; Using index 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
......
...@@ -133,7 +133,7 @@ e f ...@@ -133,7 +133,7 @@ e f
delete from t1 where b > 35; delete from t1 where b > 35;
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
......
...@@ -133,7 +133,7 @@ e f ...@@ -133,7 +133,7 @@ e f
delete from t1 where b > 35; delete from t1 where b > 35;
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
......
...@@ -26,7 +26,7 @@ max(a) ...@@ -26,7 +26,7 @@ max(a)
-1 -1
explain select a,b from z1 where a < 9; explain select a,b from z1 where a < 9;
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 range a a 5 NULL 13 Using where; Using index 1 SIMPLE z1 index a a 10 NULL 14 Using where; Using index
select max(a) from z1 where a < 9; select max(a) from z1 where a < 9;
max(a) max(a)
7 7
......
...@@ -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; Using index 1 SIMPLE t1 index 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
...@@ -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; Using index 1 SIMPLE t1 index 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
...@@ -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; Using index 1 SIMPLE t1 index 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
......
...@@ -14,5 +14,5 @@ select * from t; ...@@ -14,5 +14,5 @@ select * from t;
a b a b
select TABLE_ROWS from information_schema.tables where table_schema='test' and table_name='t'; select TABLE_ROWS from information_schema.tables where table_schema='test' and table_name='t';
TABLE_ROWS TABLE_ROWS
1 0
drop table t; drop table t;
...@@ -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; Using index 1 SIMPLE foo index b b 5 NULL 5 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
......
...@@ -8,5 +8,5 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -8,5 +8,5 @@ id select_type table type possible_keys key key_len ref rows Extra
CREATE INDEX it on t(t); CREATE INDEX it on t(t);
EXPLAIN SELECT * FROM t WHERE r > 0; EXPLAIN SELECT * FROM t WHERE r > 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 t index PRIMARY it 9 NULL NULL; Using where; Using index 1 SIMPLE t range PRIMARY PRIMARY 4 NULL NULL; Using where
DROP TABLE t; DROP TABLE t;
...@@ -3,7 +3,7 @@ drop table if exists t; ...@@ -3,7 +3,7 @@ drop table if exists t;
create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2; create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2;
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 2 NULL NULL BTREE t 0 PRIMARY 1 id A 0 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
insert into t values (1,1),(3,1),(5,1); insert into t values (1,1),(3,1),(5,1);
insert into t values (2,1),(4,1),(6,1); insert into t values (2,1),(4,1),(6,1);
......
...@@ -3,18 +3,18 @@ drop table if exists t; ...@@ -3,18 +3,18 @@ drop table if exists t;
create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2; create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2;
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 2 NULL NULL BTREE t 0 PRIMARY 1 id A 0 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
insert into t values (1,1),(3,1),(5,1); insert into t values (1,1),(3,1),(5,1);
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 4 NULL NULL BTREE t 0 PRIMARY 1 id A 3 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
analyze table t; analyze table t;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t analyze status OK test.t analyze status OK
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 4 NULL NULL BTREE t 0 PRIMARY 1 id A 3 NULL NULL BTREE
t 1 x 1 x A 1 NULL NULL YES BTREE t 1 x 1 x A 1 NULL NULL YES BTREE
drop table t; drop table t;
...@@ -3,7 +3,7 @@ drop table if exists t; ...@@ -3,7 +3,7 @@ drop table if exists t;
create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2; create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2;
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 2 NULL NULL BTREE t 0 PRIMARY 1 id A 0 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
insert into t values (1,1),(3,2),(5,3); insert into t values (1,1),(3,2),(5,3);
insert into t values (2,1),(4,1),(6,1),(8,1); insert into t values (2,1),(4,1),(6,1),(8,1);
......
...@@ -3,18 +3,18 @@ drop table if exists t; ...@@ -3,18 +3,18 @@ drop table if exists t;
create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2; create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2;
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 2 NULL NULL BTREE t 0 PRIMARY 1 id A 0 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
insert into t values (2,1),(4,1),(6,1); insert into t values (2,1),(4,1),(6,1);
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 4 NULL NULL BTREE t 0 PRIMARY 1 id A 3 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
analyze table t; analyze table t;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t analyze status OK test.t analyze status OK
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 4 NULL NULL BTREE t 0 PRIMARY 1 id A 3 NULL NULL BTREE
t 1 x 1 x A 1 NULL NULL YES BTREE t 1 x 1 x A 1 NULL NULL YES BTREE
drop table t; drop table t;
...@@ -3,7 +3,7 @@ drop table if exists t; ...@@ -3,7 +3,7 @@ drop table if exists t;
create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2; create table t (id int, x int, primary key (id), key (x)) partition by hash(id) partitions 2;
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 2 NULL NULL BTREE t 0 PRIMARY 1 id A 0 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
insert into t values (1,1),(3,2),(5,3),(7,4); insert into t values (1,1),(3,2),(5,3),(7,4);
insert into t values (2,1),(4,1),(6,1); insert into t values (2,1),(4,1),(6,1);
......
...@@ -6,7 +6,7 @@ partition by range(id) ...@@ -6,7 +6,7 @@ partition by range(id)
insert into t values (1,1,1),(2,1,2),(3,1,3),(4,1,4); insert into t values (1,1,1),(2,1,2),(3,1,3),(4,1,4);
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 5 NULL NULL BTREE t 0 PRIMARY 1 id A 4 NULL NULL BTREE
t 1 x 1 x A NULL NULL NULL YES BTREE t 1 x 1 x A NULL NULL NULL YES BTREE
t 1 y 1 y A NULL NULL NULL YES BTREE t 1 y 1 y A NULL NULL NULL YES BTREE
alter table t analyze partition p0; alter table t analyze partition p0;
...@@ -14,17 +14,17 @@ Table Op Msg_type Msg_text ...@@ -14,17 +14,17 @@ Table Op Msg_type Msg_text
test.t analyze status OK test.t analyze status OK
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 5 NULL NULL BTREE t 0 PRIMARY 1 id A 4 NULL NULL BTREE
t 1 x 1 x A 1 NULL NULL YES BTREE t 1 x 1 x A 1 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE t 1 y 1 y A 4 NULL NULL YES BTREE
alter table t analyze partition p1; alter table t analyze partition p1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t analyze status OK test.t analyze status OK
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 5 NULL NULL BTREE t 0 PRIMARY 1 id A 4 NULL NULL BTREE
t 1 x 1 x A 1 NULL NULL YES BTREE t 1 x 1 x A 1 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE t 1 y 1 y A 4 NULL NULL YES BTREE
insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1); insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1);
show indexes from t; show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
......
CREATE TABLE t1 (i INT) ENGINE=TokuDB; CREATE TABLE t1 (i INT) ENGINE=TokuDB;
EXPLAIN INSERT INTO t1 SELECT * FROM t1; EXPLAIN INSERT INTO t1 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 1 Using temporary 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using temporary
INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
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