mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-16188 Post merge fixes fot TokuDB
This commit is contained in:
@@ -717,11 +717,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||
IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition
|
||||
1 SIMPLE t1 ALL c_timestamp NULL NULL NULL 20 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||
IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition
|
||||
1 SIMPLE t1 ALL c_timestamp NULL NULL NULL 20 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
@@ -735,12 +735,12 @@ Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
EXPLAIN DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 1 Using where; Using filesort
|
||||
FLUSH STATUS;
|
||||
FLUSH TABLES;
|
||||
EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 1 100.00 Using where; Using filesort
|
||||
# Status of EXPLAIN EXTENDED query
|
||||
Variable_name Value
|
||||
Handler_read_key 3
|
||||
@@ -764,6 +764,8 @@ Handler_read_rnd_next 1
|
||||
# Status of testing query execution:
|
||||
Variable_name Value
|
||||
Handler_read_key 3
|
||||
Handler_read_rnd_next 1
|
||||
Sort_scan 1
|
||||
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (-1), (-2), (-3);
|
||||
#
|
||||
|
@@ -506,7 +506,7 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
|
||||
(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
|
||||
WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
|
||||
(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
|
||||
|
@@ -714,7 +714,7 @@ FieldKey LongVal StringVal
|
||||
3 3 3
|
||||
EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range FieldKey,LongField,StringField LongField 38 NULL 3 Using where
|
||||
1 SIMPLE t1 range FieldKey,LongField,StringField LongField 38 NULL 3 Using index condition
|
||||
SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
|
||||
FieldKey LongVal StringVal
|
||||
3 1 2
|
||||
|
@@ -2676,13 +2676,13 @@ explain partitions
|
||||
select * from t1 X, t1 Y
|
||||
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE X p1,p2 range a,b a 4 NULL 4 Using where
|
||||
1 SIMPLE Y p2,p3 ref|filter a,b b|a 4|4 test.X.b 2 (50%) Using where; Using rowid filter
|
||||
1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 8 Using where
|
||||
1 SIMPLE Y p2,p3 ALL a,b NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE X p1,p2 range a a 4 NULL 4 Using where
|
||||
1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
|
||||
1 SIMPLE X p1,p2 ALL a NULL NULL NULL 8 Using where
|
||||
1 SIMPLE Y p1,p2 ALL a NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||
drop table t1;
|
||||
create table t1 (a int) partition by hash(a) partitions 20;
|
||||
insert into t1 values (1),(2),(3);
|
||||
|
@@ -4748,6 +4748,8 @@ public:
|
||||
virtual void update_partition(uint part_id)
|
||||
{}
|
||||
|
||||
virtual bool is_clustering_key(uint index) { return false; }
|
||||
|
||||
protected:
|
||||
Handler_share *get_ha_share_ptr();
|
||||
void set_ha_share_ptr(Handler_share *arg_ha_share);
|
||||
|
@@ -20,10 +20,16 @@
|
||||
#include "key.h"
|
||||
#include "sql_statistics.h"
|
||||
|
||||
static ulonglong key_block_no(handler *h, uint keyno, ha_rows keyentry_pos)
|
||||
static ulonglong key_block_no(TABLE *table, uint keyno, ha_rows keyentry_pos)
|
||||
{
|
||||
return (ulonglong) (h->keyread_time(keyno, 1, keyentry_pos + 1) -
|
||||
h->keyread_time(keyno, 0, keyentry_pos + 1) + 0.5) + 1;
|
||||
size_t len= table->key_info[keyno].key_length + table->file->ref_length;
|
||||
if (keyno == table->s->primary_key &&
|
||||
table->file->primary_key_is_clustered())
|
||||
len= table->s->stored_rec_length;
|
||||
uint keys_per_block= (uint) (table->file->stats.block_size/2.0/len+1);
|
||||
ulonglong block_no= !keyentry_pos ? 0 :
|
||||
(keyentry_pos - 1) / keys_per_block + 1;
|
||||
return block_no;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -177,8 +183,8 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
|
||||
}
|
||||
min_pos+= r - rows;
|
||||
}
|
||||
min_block_no= key_block_no(this, keyno, min_pos);
|
||||
max_block_no= key_block_no(this, keyno, min_pos + rows);
|
||||
min_block_no= key_block_no(this->table, keyno, min_pos);
|
||||
max_block_no= key_block_no(this->table, keyno, min_pos + rows);
|
||||
new_touched_blocks= max_block_no - min_block_no +
|
||||
MY_TEST(min_block_no != prev_max_block_no);
|
||||
prev_max_block_no= max_block_no;
|
||||
@@ -202,7 +208,8 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
|
||||
cost->reset();
|
||||
cost->avg_io_cost= 1; /* assume random seeks */
|
||||
cost->idx_avg_io_cost= 1;
|
||||
if (!(keyno == table->s->primary_key && primary_key_is_clustered()))
|
||||
if (!((keyno == table->s->primary_key && primary_key_is_clustered()) ||
|
||||
is_clustering_key(keyno)))
|
||||
{
|
||||
cost->idx_io_count= total_touched_blocks +
|
||||
keyread_time(keyno, 0, total_rows);
|
||||
|
@@ -7775,13 +7775,18 @@ double ha_tokudb::scan_time() {
|
||||
DBUG_RETURN(ret_val);
|
||||
}
|
||||
|
||||
bool ha_tokudb::is_clustering_key(uint index)
|
||||
{
|
||||
return index == primary_key || key_is_clustering(&table->key_info[index]);
|
||||
}
|
||||
|
||||
double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
|
||||
{
|
||||
TOKUDB_HANDLER_DBUG_ENTER("%u %u %" PRIu64, index, ranges, (uint64_t) rows);
|
||||
double ret_val;
|
||||
if (index == primary_key || key_is_clustering(&table->key_info[index])) {
|
||||
ret_val = read_time(index, ranges, rows);
|
||||
DBUG_RETURN(ret_val);
|
||||
double cost;
|
||||
if (index == primary_key || is_clustering_key(index)) {
|
||||
cost = read_time(index, ranges, rows);
|
||||
DBUG_RETURN(cost);
|
||||
}
|
||||
/*
|
||||
It is assumed that we will read trough the whole key range and that all
|
||||
@@ -7791,11 +7796,8 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
|
||||
blocks read. This model does not take into account clustered indexes -
|
||||
engines that support that (e.g. InnoDB) may want to overwrite this method.
|
||||
*/
|
||||
double keys_per_block= (stats.block_size/2.0/
|
||||
(table->key_info[index].key_length +
|
||||
ref_length) + 1);
|
||||
ret_val = (rows + keys_per_block - 1)/ keys_per_block;
|
||||
TOKUDB_HANDLER_DBUG_RETURN_DOUBLE(ret_val);
|
||||
cost= handler::keyread_time(index, ranges, rows);
|
||||
TOKUDB_HANDLER_DBUG_RETURN_DOUBLE(cost);
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -871,6 +871,7 @@ public:
|
||||
bool primary_key_is_clustered() {
|
||||
return true;
|
||||
}
|
||||
bool is_clustering_key(uint index);
|
||||
int cmp_ref(const uchar * ref1, const uchar * ref2);
|
||||
bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
|
||||
|
||||
|
@@ -1,7 +1,10 @@
|
||||
# test for TokuDB clustering keys.
|
||||
# test assumes that a table 't1' exists with the following columns:
|
||||
# a int, b int, c int, d int
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
|
||||
|
||||
#normal queries
|
||||
@@ -13,20 +16,20 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a from t1 where a > 8;
|
||||
select a from t1 where a > 8;
|
||||
explain select a from t1 where a > 10;
|
||||
select a from t1 where a > 10;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
@@ -35,8 +38,8 @@ select a,b from t1 where b > 30;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 350;
|
||||
select a,c from t1 where c > 350;
|
||||
|
||||
|
||||
alter table t1 add index bdca(b,d,c,a) clustering=yes;
|
||||
@@ -51,25 +54,25 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select b from t1 where b > 30;
|
||||
select b from t1 where b > 30;
|
||||
explain select b from t1 where b > 70;
|
||||
select b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select b from t1 where c > 750;
|
||||
select c from t1 where c > 750;
|
||||
explain select b from t1 where c > 950;
|
||||
select c from t1 where c > 950;
|
||||
|
||||
alter table t1 add e varchar(20);
|
||||
|
||||
@@ -77,25 +80,25 @@ alter table t1 add primary key (a,b,c);
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where a > 5;
|
||||
select * from t1 where a > 5;
|
||||
explain select * from t1 where a > 8;
|
||||
select * from t1 where a > 8;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a from t1 where a > 8;
|
||||
select a from t1 where a > 8;
|
||||
explain select a from t1 where a > 10;
|
||||
select a from t1 where a > 10;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
@@ -104,8 +107,8 @@ select a,b from t1 where b > 30;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 350;
|
||||
select a,c from t1 where c > 350;
|
||||
|
||||
|
||||
alter table t1 drop primary key;
|
||||
@@ -116,23 +119,23 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select b from t1 where b > 30;
|
||||
select b from t1 where b > 30;
|
||||
explain select b from t1 where b > 70;
|
||||
select b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select b from t1 where c > 750;
|
||||
select c from t1 where c > 750;
|
||||
explain select b from t1 where c > 950;
|
||||
select c from t1 where c > 950;
|
||||
|
||||
|
||||
|
@@ -1096,7 +1096,7 @@ t CREATE TABLE `t` (
|
||||
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
|
||||
1 SIMPLE s index b,b_2,b_3 b_2 10 NULL 1000 Using where; Using index
|
||||
1 SIMPLE t ref b,b_2,b_3 b_2 5 test.s.b 1 Using index
|
||||
1 SIMPLE t ref b,b_2,b_3 b_3 5 test.s.b 1 Using index
|
||||
alter table s drop key b_2;
|
||||
alter table t drop key b_2;
|
||||
show create table s;
|
||||
|
@@ -39,16 +39,20 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `foo` (`c`,`d`) `clustering`=yes,
|
||||
KEY `bar` (`d`,`c`,`b`,`a`) `clustering`=yes
|
||||
) ENGINE=TokuDB DEFAULT CHARSET=latin1
|
||||
insert into t1 value (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(32,54,12,56);
|
||||
insert into t1 value
|
||||
(1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),
|
||||
(32,54,12,56);
|
||||
explain select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 16 NULL 5 Using index
|
||||
1 SIMPLE t1 index NULL PRIMARY 16 NULL 7 Using index
|
||||
select * from t1;
|
||||
a b c d
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
6 6 6 6
|
||||
32 54 12 56
|
||||
explain select d from t1 where d > 30;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@@ -1,7 +1,10 @@
|
||||
SET DEFAULT_STORAGE_ENGINE='tokudb';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
@@ -11,48 +14,47 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 70;
|
||||
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
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
4 40 400 4000
|
||||
5 50 500 5000
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 850;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
select * from t1 where c > 850;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select a from t1 where a > 8;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
select a from t1 where a > 10;
|
||||
a
|
||||
9
|
||||
explain select a,b from t1 where b > 30;
|
||||
11
|
||||
explain select a,b from t1 where b > 70;
|
||||
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
|
||||
select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 70;
|
||||
a b
|
||||
4 40
|
||||
5 50
|
||||
6 60
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 950;
|
||||
a c
|
||||
8 800
|
||||
9 900
|
||||
10 1000
|
||||
11 1100
|
||||
delete from t1 where b>30 and b < 60;
|
||||
select * from t1;
|
||||
a b c d
|
||||
@@ -63,15 +65,16 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where a > 5;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where a > 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
select * from t1 where a > 5;
|
||||
select * from t1 where a > 8;
|
||||
a b c d
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 30;
|
||||
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
|
||||
@@ -81,19 +84,25 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 750;
|
||||
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;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
1 SIMPLE t1 index PRIMARY c 5 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
a
|
||||
9
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
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
|
||||
@@ -103,13 +112,14 @@ a b
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 1050;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 1050;
|
||||
a c
|
||||
8 800
|
||||
9 900
|
||||
11 1100
|
||||
alter table t1 drop primary key;
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -120,22 +130,23 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 70;
|
||||
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
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 1050;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 1050;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
@@ -145,61 +156,76 @@ a
|
||||
7
|
||||
8
|
||||
9
|
||||
explain select a,b from t1 where b > 30;
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 70;
|
||||
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
|
||||
select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 70;
|
||||
a b
|
||||
6 60
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 1050;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 1050;
|
||||
a c
|
||||
8 800
|
||||
9 900
|
||||
11 1100
|
||||
delete from t1 where b > 10 and b < 90;
|
||||
select * from t1;
|
||||
a b c d
|
||||
1 10 100 1000
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
select * from t1 where a > 5;
|
||||
a b c d
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 30;
|
||||
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
|
||||
select * from t1 where b > 30;
|
||||
a b c d
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
a b c d
|
||||
9 90 900 9000
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
select a from t1 where a > 5;
|
||||
a
|
||||
9
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
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
|
||||
select a,b from t1 where b > 30;
|
||||
a b
|
||||
9 90
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
a c
|
||||
9 900
|
||||
10 1000
|
||||
11 1100
|
||||
drop table t1;
|
||||
|
@@ -7,22 +7,19 @@ insert into t1 values (2,"20",200);
|
||||
insert into t1 values (3,"30",300);
|
||||
insert into t1 values (4,"40",400);
|
||||
insert into t1 values (5,"50",500);
|
||||
explain select * from t1 where a > 2;
|
||||
explain select * from t1 where a > 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 3 Using where
|
||||
select * from t1 where a > 2;
|
||||
1 SIMPLE t1 range a a 5 NULL 2 Using where
|
||||
select * from t1 where a > 3;
|
||||
a b c
|
||||
3 30 300
|
||||
4 40 400
|
||||
5 50 500
|
||||
select b from t1 where a > 2;
|
||||
select b from t1 where a > 3;
|
||||
b
|
||||
30
|
||||
40
|
||||
50
|
||||
select c from t1 where a > 2;
|
||||
select c from t1 where a > 3;
|
||||
c
|
||||
300
|
||||
400
|
||||
500
|
||||
delete from t1 where a <2;
|
||||
|
@@ -1,7 +1,10 @@
|
||||
SET DEFAULT_STORAGE_ENGINE='tokudb';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b,c), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
@@ -11,30 +14,30 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
4 40 400 4000
|
||||
5 50 500 5000
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select a from t1 where a > 8;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
select a from t1 where a > 10;
|
||||
a
|
||||
9
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index b c 4 NULL NULL; Using where; Using index
|
||||
@@ -46,13 +49,21 @@ a b
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 350;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index c c 4 NULL NULL; Using where; Using index
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 350;
|
||||
a c
|
||||
4 400
|
||||
5 500
|
||||
6 600
|
||||
7 700
|
||||
8 800
|
||||
9 900
|
||||
10 1000
|
||||
11 1100
|
||||
alter table t1 add index bdca(b,d,c,a) clustering=yes;
|
||||
insert into t1 values (10,10,10,10);
|
||||
alter table t1 drop index bdca;
|
||||
@@ -67,79 +78,73 @@ a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
10 10 10 10
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
4 40 400 4000
|
||||
5 50 500 5000
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select b from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select b from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select b from t1 where b > 30;
|
||||
select b from t1 where b > 70;
|
||||
b
|
||||
40
|
||||
50
|
||||
60
|
||||
70
|
||||
80
|
||||
90
|
||||
explain select b from t1 where c > 750;
|
||||
100
|
||||
110
|
||||
explain select b from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select c from t1 where c > 750;
|
||||
select c from t1 where c > 950;
|
||||
c
|
||||
800
|
||||
900
|
||||
1000
|
||||
1100
|
||||
alter table t1 add e varchar(20);
|
||||
alter table t1 add primary key (a,b,c);
|
||||
explain select * from t1 where a > 5;
|
||||
explain select * from t1 where a > 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
select * from t1 where a > 5;
|
||||
select * from t1 where a > 8;
|
||||
a b c d e
|
||||
6 60 600 6000 NULL
|
||||
7 70 700 7000 NULL
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
10 10 10 10 NULL
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select * from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d e
|
||||
4 40 400 4000 NULL
|
||||
5 50 500 5000 NULL
|
||||
6 60 600 6000 NULL
|
||||
7 70 700 7000 NULL
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d e
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
explain select a from t1 where a > 8;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select a from t1 where a > 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
select a from t1 where a > 10;
|
||||
a
|
||||
9
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index b c 4 NULL NULL; Using where; Using index
|
||||
@@ -151,13 +156,21 @@ a b
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 350;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index c c 4 NULL NULL; Using where; Using index
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 350;
|
||||
a c
|
||||
4 400
|
||||
5 500
|
||||
6 600
|
||||
7 700
|
||||
8 800
|
||||
9 900
|
||||
10 1000
|
||||
11 1100
|
||||
alter table t1 drop primary key;
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -169,40 +182,38 @@ a b c d e
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
10 10 10 10 NULL
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select * from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d e
|
||||
4 40 400 4000 NULL
|
||||
5 50 500 5000 NULL
|
||||
6 60 600 6000 NULL
|
||||
7 70 700 7000 NULL
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d e
|
||||
8 80 800 8000 NULL
|
||||
9 90 900 9000 NULL
|
||||
explain select b from t1 where b > 30;
|
||||
10 100 1000 10000 NULL
|
||||
11 110 1100 11000 NULL
|
||||
explain select b from t1 where b > 70;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range b b 4 NULL NULL; Using where; Using index
|
||||
select b from t1 where b > 30;
|
||||
select b from t1 where b > 70;
|
||||
b
|
||||
40
|
||||
50
|
||||
60
|
||||
70
|
||||
80
|
||||
90
|
||||
explain select b from t1 where c > 750;
|
||||
100
|
||||
110
|
||||
explain select b from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL NULL; Using where
|
||||
select c from t1 where c > 750;
|
||||
select c from t1 where c > 950;
|
||||
c
|
||||
800
|
||||
900
|
||||
1000
|
||||
1100
|
||||
drop table t1;
|
||||
|
@@ -2,16 +2,16 @@ SET DEFAULT_STORAGE_ENGINE='tokudb';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
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 > 5;
|
||||
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
|
||||
explain select * from t1 where c > 2;
|
||||
explain select * from t1 where c > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
explain select * from t1 where a > 4;
|
||||
explain select * from t1 where a > 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
explain select * from t1 where c > 7;
|
||||
explain select * from t1 where c > 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
explain select * from t1 where b > 7;
|
||||
|
@@ -32,13 +32,13 @@ max(a)
|
||||
7
|
||||
explain select a,b from z1 where a < 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE z1 range a a 5 NULL 12 Using where; Using index
|
||||
1 SIMPLE z1 index a a 10 NULL 14 Using where; Using index
|
||||
select max(a) from z1 where a < 7;
|
||||
max(a)
|
||||
3
|
||||
explain select a,b from z1 where a < 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE z1 range a a 5 NULL 9 Using where; Using index
|
||||
1 SIMPLE z1 index a a 10 NULL 14 Using where; Using index
|
||||
select max(a) from z1 where a < 3;
|
||||
max(a)
|
||||
1
|
||||
|
@@ -1,7 +1,10 @@
|
||||
SET DEFAULT_STORAGE_ENGINE='tokudb';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where
|
||||
@@ -11,48 +14,48 @@ a b c d
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where b > 30;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where b > 70;
|
||||
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
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
4 40 400 4000
|
||||
5 50 500 5000
|
||||
6 60 600 6000
|
||||
7 70 700 7000
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d
|
||||
8 80 800 8000
|
||||
9 90 900 9000
|
||||
explain select a from t1 where a > 8;
|
||||
10 100 1000 10000
|
||||
11 110 1100 11000
|
||||
explain select a from t1 where a > 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
a
|
||||
9
|
||||
explain select a,b from t1 where b > 30;
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 70;
|
||||
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
|
||||
select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 70;
|
||||
a b
|
||||
4 40
|
||||
5 50
|
||||
6 60
|
||||
7 70
|
||||
8 80
|
||||
9 90
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 100
|
||||
11 110
|
||||
explain select a,b from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 950;
|
||||
a c
|
||||
8 800
|
||||
9 900
|
||||
10 1000
|
||||
11 1100
|
||||
update t1 set c = c+5, b = b+5 where b>30;
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -63,6 +66,8 @@ a b c d
|
||||
7 75 705 7000
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select * from t1 where b > 30;
|
||||
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
|
||||
@@ -74,6 +79,8 @@ a b c d
|
||||
7 75 705 7000
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select * from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
@@ -81,12 +88,14 @@ select * from t1 where c > 750;
|
||||
a b c d
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
explain select a from t1 where a > 8;
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select a from t1 where a > 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL NULL; Using where; Using index
|
||||
select a from t1 where a > 8;
|
||||
select a from t1 where a > 10;
|
||||
a
|
||||
9
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 NA b b 5 NULL NULL; Using where; Using index
|
||||
@@ -98,6 +107,8 @@ a b
|
||||
7 75
|
||||
8 85
|
||||
9 95
|
||||
10 105
|
||||
11 115
|
||||
explain select a,b from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
@@ -105,6 +116,8 @@ select a,c from t1 where c > 750;
|
||||
a c
|
||||
8 805
|
||||
9 905
|
||||
10 1005
|
||||
11 1105
|
||||
alter table t1 drop primary key;
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -115,24 +128,25 @@ a b c d
|
||||
7 75 705 7000
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
explain select * from t1 where b > 30;
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select * from t1 where b > 70;
|
||||
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
|
||||
select * from t1 where b > 30;
|
||||
select * from t1 where b > 70;
|
||||
a b c d
|
||||
4 45 405 4000
|
||||
5 55 505 5000
|
||||
6 65 605 6000
|
||||
7 75 705 7000
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
explain select * from t1 where c > 750;
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select * from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select * from t1 where c > 750;
|
||||
select * from t1 where c > 950;
|
||||
a b c d
|
||||
8 85 805 8000
|
||||
9 95 905 9000
|
||||
10 105 1005 10000
|
||||
11 115 1105 11000
|
||||
explain select a from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
@@ -142,24 +156,25 @@ a
|
||||
7
|
||||
8
|
||||
9
|
||||
explain select a,b from t1 where b > 30;
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 70;
|
||||
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
|
||||
select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 70;
|
||||
a b
|
||||
4 45
|
||||
5 55
|
||||
6 65
|
||||
7 75
|
||||
8 85
|
||||
9 95
|
||||
explain select a,b from t1 where c > 750;
|
||||
10 105
|
||||
11 115
|
||||
explain select a,b from t1 where c > 950;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL NULL; Using where
|
||||
select a,c from t1 where c > 750;
|
||||
select a,c from t1 where c > 950;
|
||||
a c
|
||||
8 805
|
||||
9 905
|
||||
10 1005
|
||||
11 1105
|
||||
update t1 set c = c+5, b = b+5 where b>30;
|
||||
select * from t1;
|
||||
a b c d
|
||||
@@ -172,6 +187,8 @@ a b c d
|
||||
7 80 710 7000
|
||||
8 90 810 8000
|
||||
9 100 910 9000
|
||||
10 110 1010 10000
|
||||
11 120 1110 11000
|
||||
explain select * from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
@@ -181,6 +198,8 @@ a b c d
|
||||
7 80 710 7000
|
||||
8 90 810 8000
|
||||
9 100 910 9000
|
||||
10 110 1010 10000
|
||||
11 120 1110 11000
|
||||
explain select * from t1 where b > 30;
|
||||
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
|
||||
@@ -192,6 +211,8 @@ a b c d
|
||||
7 80 710 7000
|
||||
8 90 810 8000
|
||||
9 100 910 9000
|
||||
10 110 1010 10000
|
||||
11 120 1110 11000
|
||||
explain select * from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
@@ -199,6 +220,8 @@ select * from t1 where c > 750;
|
||||
a b c d
|
||||
8 90 810 8000
|
||||
9 100 910 9000
|
||||
10 110 1010 10000
|
||||
11 120 1110 11000
|
||||
explain select a from t1 where a > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL NULL; Using where
|
||||
@@ -208,6 +231,8 @@ a
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
explain select a,b from t1 where b > 30;
|
||||
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
|
||||
@@ -219,6 +244,8 @@ a b
|
||||
7 80
|
||||
8 90
|
||||
9 100
|
||||
10 110
|
||||
11 120
|
||||
explain select a,b from t1 where c > 750;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL NULL; Using where
|
||||
@@ -226,4 +253,6 @@ select a,c from t1 where c > 750;
|
||||
a c
|
||||
8 810
|
||||
9 910
|
||||
10 1010
|
||||
11 1110
|
||||
drop table t1;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
drop table if exists t;
|
||||
select @@optimizer_switch;
|
||||
@@optimizer_switch
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on
|
||||
create table t (id int not null, x int not null, y int not null, primary key(id), key(x)) engine=innodb;
|
||||
insert into t values (0,0,0),(1,1,1),(2,2,2),(3,2,3),(4,2,4);
|
||||
explain select x,id from t force index (x) where x=0 and id=0;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
drop table if exists t;
|
||||
select @@optimizer_switch;
|
||||
@@optimizer_switch
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on
|
||||
create table t (id int not null, x int not null, y int not null, primary key(id), key(x)) engine=tokudb;
|
||||
insert into t values (0,0,0),(1,1,1),(2,2,2),(3,2,3),(4,2,4);
|
||||
explain select x,id from t force index (x) where x=0 and id=0;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
drop table if exists t;
|
||||
select @@optimizer_switch;
|
||||
@@optimizer_switch
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on
|
||||
create table t (a int not null, b int not null, c int not null, d int not null, primary key(a,b), key(c,a)) engine=innodb;
|
||||
insert into t values (0,0,0,0),(0,1,0,1);
|
||||
explain select c,a,b from t where c=0 and a=0 and b=1;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
drop table if exists t;
|
||||
select @@optimizer_switch;
|
||||
@@optimizer_switch
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on
|
||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on
|
||||
create table t (a int not null, b int not null, c int not null, d int not null, primary key(a,b), key(c,a)) engine=tokudb;
|
||||
insert into t values (0,0,0,0),(0,1,0,1);
|
||||
explain select c,a,b from t where c=0 and a=0 and b=1;
|
||||
|
@@ -31,7 +31,7 @@ delete from foo where a > 5;
|
||||
# number of rows should be 9
|
||||
explain select * from foo where a > 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 9 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# should have just 4 values
|
||||
select * from foo where a > 1;
|
||||
a b
|
||||
@@ -43,7 +43,7 @@ connection conn1;
|
||||
# number of rows should be 9
|
||||
explain select * from foo where a > 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 9 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# 9 values
|
||||
select * From foo where a > 1;
|
||||
a b
|
||||
|
@@ -31,7 +31,7 @@ delete from foo where a < 10;
|
||||
# number of rows should be 9
|
||||
explain select * from foo where a < 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 9 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# should have just 4 values
|
||||
select * from foo where a < 50;
|
||||
a b
|
||||
@@ -43,7 +43,7 @@ connection conn1;
|
||||
# number of rows should be 9
|
||||
explain select * from foo where a < 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 9 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# 9 values
|
||||
select * From foo where a < 50;
|
||||
a b
|
||||
|
@@ -31,7 +31,7 @@ delete from foo where a = 2 or a = 4 or a = 10 or a = 30 or a = 50;
|
||||
# number of rows should be 8
|
||||
explain select * from foo where a > 1 and a < 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 8 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# should have just 4 values
|
||||
select * from foo where a > 1 and a < 50;
|
||||
a b
|
||||
@@ -43,7 +43,7 @@ connection conn1;
|
||||
# number of rows should be 8
|
||||
explain select * from foo where a > 1 and a < 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 8 Using where
|
||||
1 SIMPLE foo range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
# 8 values
|
||||
select * from foo where a > 1 and a < 50;
|
||||
a b
|
||||
|
@@ -305,25 +305,25 @@ dummy INT PRIMARY KEY,
|
||||
a INT UNIQUE,
|
||||
b INT
|
||||
) ENGINE=TokuDB;
|
||||
INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5);
|
||||
INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5),(7,7,7),(8,8,8),(9,9,9);
|
||||
COMMIT;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@tx_isolation;
|
||||
@@tx_isolation
|
||||
REPEATABLE-READ
|
||||
START TRANSACTION;
|
||||
EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
|
||||
EXPLAIN SELECT * FROM t1 WHERE a >= 8 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
|
||||
SELECT * FROM t1 WHERE a >= 8 FOR UPDATE;
|
||||
dummy a b
|
||||
3 3 3
|
||||
5 5 5
|
||||
8 8 8
|
||||
9 9 9
|
||||
connection con2;
|
||||
SET AUTOCOMMIT=0;
|
||||
SET TOKUDB_LOCK_TIMEOUT=2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES (2,2,2);
|
||||
INSERT INTO t1 VALUES (8,8,8);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ROLLBACK;
|
||||
connection con1;
|
||||
|
@@ -759,7 +759,7 @@ CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
|
||||
INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
|
||||
EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 2 NULL 4 Using where; Using index; Using filesort
|
||||
1 SIMPLE t1 index a a 5 NULL 5 Using where; Using index; Using filesort
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1(a bit(7));
|
||||
|
@@ -667,14 +667,14 @@ id txt
|
||||
alter table t1 modify column txt blob;
|
||||
explain select * from t1 where txt='Chevy' or txt is NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL txt_index NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
|
||||
select * from t1 where txt='Chevy' or txt is NULL;
|
||||
id txt
|
||||
1 Chevy
|
||||
3 NULL
|
||||
explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL txt_index NULL NULL NULL 4 Using where; Using filesort
|
||||
1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort
|
||||
select * from t1 where txt='Chevy' or txt is NULL order by txt;
|
||||
id txt
|
||||
3 NULL
|
||||
|
@@ -22,7 +22,9 @@ alter table t1 drop primary key;
|
||||
alter table t1 add primary key (a,b,c,d);
|
||||
alter table t1 add key bar(d,c,b,a) clustering=yes;
|
||||
show create table t1;
|
||||
insert into t1 value (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(32,54,12,56);
|
||||
insert into t1 value
|
||||
(1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),
|
||||
(32,54,12,56);
|
||||
explain select * from t1;
|
||||
select * from t1;
|
||||
explain select d from t1 where d > 30;
|
||||
|
@@ -7,8 +7,10 @@ DROP TABLE IF EXISTS t1;
|
||||
|
||||
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
|
||||
#normal queries
|
||||
|
||||
@@ -19,38 +21,38 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 850;
|
||||
select * from t1 where c > 850;
|
||||
|
||||
#covering indexes
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a from t1 where a > 8;
|
||||
select a from t1 where a > 8;
|
||||
explain select a from t1 where a > 10;
|
||||
select a from t1 where a > 10;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 30;
|
||||
explain select a,b from t1 where b > 70;
|
||||
select a,b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 950;
|
||||
select a,c from t1 where c > 950;
|
||||
|
||||
delete from t1 where b>30 and b < 60;
|
||||
select * from t1;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where a > 5;
|
||||
select * from t1 where a > 5;
|
||||
explain select * from t1 where a > 8;
|
||||
select * from t1 where a > 8;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
@@ -76,8 +78,8 @@ select a,b from t1 where b > 30;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 1050;
|
||||
select a,c from t1 where c > 1050;
|
||||
|
||||
|
||||
alter table t1 drop primary key;
|
||||
@@ -88,13 +90,13 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 1050;
|
||||
select * from t1 where c > 1050;
|
||||
|
||||
#covering indexes
|
||||
|
||||
@@ -105,13 +107,13 @@ select a from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 30;
|
||||
explain select a,b from t1 where b > 70;
|
||||
select a,b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 1050;
|
||||
select a,c from t1 where c > 1050;
|
||||
|
||||
|
||||
delete from t1 where b > 10 and b < 90;
|
||||
|
@@ -13,10 +13,10 @@ insert into t1 values (3,"30",300);
|
||||
insert into t1 values (4,"40",400);
|
||||
insert into t1 values (5,"50",500);
|
||||
|
||||
explain select * from t1 where a > 2;
|
||||
select * from t1 where a > 2;
|
||||
select b from t1 where a > 2;
|
||||
select c from t1 where a > 2;
|
||||
explain select * from t1 where a > 3;
|
||||
select * from t1 where a > 3;
|
||||
select b from t1 where a > 3;
|
||||
select c from t1 where a > 3;
|
||||
|
||||
#explain delete from t1 where a <2;
|
||||
delete from t1 where a <2;
|
||||
|
@@ -11,18 +11,18 @@ 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
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 2;
|
||||
explain select * from t1 where b > 5;
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 2;
|
||||
explain select * from t1 where c > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where a > 4;
|
||||
explain select * from t1 where a > 7;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 7;
|
||||
explain select * from t1 where c > 8;
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 7;
|
||||
|
@@ -7,7 +7,10 @@ DROP TABLE IF EXISTS t1;
|
||||
|
||||
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes, key (c))engine=tokudb;
|
||||
|
||||
insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),(9,90,900,9000);
|
||||
insert into t1 values
|
||||
(1,10,100,1000),(2,20,200,2000),(3,30,300,3000),(4,40,400,4000),
|
||||
(5,50,500,5000),(6,60,600,6000),(7,70,700,7000),(8,80,800,8000),
|
||||
(9,90,900,9000),(10,100,1000,10000),(11,110,1100,11000);
|
||||
|
||||
|
||||
#normal queries
|
||||
@@ -19,30 +22,30 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a from t1 where a > 8;
|
||||
explain select a from t1 where a > 10;
|
||||
select a from t1 where a > 8;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 30;
|
||||
explain select a,b from t1 where b > 70;
|
||||
select a,b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 950;
|
||||
select a,c from t1 where c > 950;
|
||||
|
||||
update t1 set c = c+5, b = b+5 where b>30;
|
||||
|
||||
@@ -64,8 +67,8 @@ select * from t1 where c > 750;
|
||||
#covering indexes
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a from t1 where a > 8;
|
||||
select a from t1 where a > 8;
|
||||
explain select a from t1 where a > 10;
|
||||
select a from t1 where a > 10;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 4 NA 9 NULL;
|
||||
@@ -86,13 +89,13 @@ select * from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where b > 30;
|
||||
select * from t1 where b > 30;
|
||||
explain select * from t1 where b > 70;
|
||||
select * from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select * from t1 where c > 750;
|
||||
select * from t1 where c > 750;
|
||||
explain select * from t1 where c > 950;
|
||||
select * from t1 where c > 950;
|
||||
|
||||
#covering indexes
|
||||
# ignore rows column
|
||||
@@ -102,13 +105,13 @@ select a from t1 where a > 5;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where b > 30;
|
||||
select a,b from t1 where b > 30;
|
||||
explain select a,b from t1 where b > 70;
|
||||
select a,b from t1 where b > 70;
|
||||
|
||||
# ignore rows column
|
||||
--replace_column 9 NULL;
|
||||
explain select a,b from t1 where c > 750;
|
||||
select a,c from t1 where c > 750;
|
||||
explain select a,b from t1 where c > 950;
|
||||
select a,c from t1 where c > 950;
|
||||
|
||||
update t1 set c = c+5, b = b+5 where b>30;
|
||||
select * from t1;
|
||||
|
@@ -40,16 +40,16 @@ CREATE TABLE t1 (
|
||||
b INT
|
||||
) ENGINE=TokuDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5);
|
||||
INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5),(7,7,7),(8,8,8),(9,9,9);
|
||||
COMMIT;
|
||||
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@tx_isolation;
|
||||
START TRANSACTION;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
|
||||
EXPLAIN SELECT * FROM t1 WHERE a >= 8 FOR UPDATE;
|
||||
|
||||
SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
|
||||
SELECT * FROM t1 WHERE a >= 8 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
|
||||
@@ -58,7 +58,7 @@ SET TOKUDB_LOCK_TIMEOUT=2;
|
||||
START TRANSACTION;
|
||||
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
INSERT INTO t1 VALUES (2,2,2);
|
||||
INSERT INTO t1 VALUES (8,8,8);
|
||||
ROLLBACK;
|
||||
|
||||
connection con1;
|
||||
|
Reference in New Issue
Block a user