Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge ../10.1-mdev6657 into bb-10.1-orderby-fixes
- Loading branch information
Showing
15 changed files
with
129 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
storage/tokudb/mysql-test/tokudb_mariadb/r/mdev6657.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
drop table if exists t1,t2,t3; | ||
create table t1(a int); | ||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); | ||
create table t2(a int); | ||
insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; | ||
CREATE TABLE t3 ( | ||
col1 int(10) unsigned NOT NULL DEFAULT '0', | ||
col2 mediumint(8) unsigned NOT NULL DEFAULT '0', | ||
col3 smallint(5) NOT NULL DEFAULT '1', | ||
filler varchar(255) DEFAULT NULL, | ||
PRIMARY KEY (col1,col2,col3), | ||
KEY key1 (col1,col2) USING BTREE | ||
) ENGINE=TokuDB DEFAULT CHARSET=latin1 PACK_KEYS=1 COMPRESSION=TOKUDB_LZMA; | ||
insert into t3 select 1300000000+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1400000000+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410799999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410899999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410999999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411099999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411199999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411299999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411399999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411499999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411599999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411699999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411899999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411999999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1412099999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1412199999+a, 12345, 7890, 'data' from t2; | ||
# The following must use range(PRIMARY): | ||
explain | ||
select col1,col2,col3 | ||
from t3 | ||
where col1 <= 1410799999 | ||
order by col1 desc,col2 desc,col3 desc limit 1; | ||
id select_type table type possible_keys key key_len ref rows Extra | ||
1 SIMPLE t3 range PRIMARY,key1 PRIMARY 4 NULL 2001 Using where; Using index | ||
# The same query but the constant is bigger. | ||
# The query should use range(PRIMARY), not full index scan: | ||
explain | ||
select col1,col2,col3 | ||
from t3 | ||
where col1 <= 1412199999 | ||
order by col1 desc, col2 desc, col3 desc limit 1; | ||
id select_type table type possible_keys key key_len ref rows Extra | ||
1 SIMPLE t3 range PRIMARY,key1 PRIMARY 4 NULL 15001 Using where; Using index | ||
drop table t1,t2,t3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--disable_warnings | ||
drop table if exists t1,t2,t3; | ||
--enable_warnings | ||
|
||
create table t1(a int); | ||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); | ||
|
||
create table t2(a int); | ||
insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; | ||
|
||
CREATE TABLE t3 ( | ||
col1 int(10) unsigned NOT NULL DEFAULT '0', | ||
col2 mediumint(8) unsigned NOT NULL DEFAULT '0', | ||
col3 smallint(5) NOT NULL DEFAULT '1', | ||
filler varchar(255) DEFAULT NULL, | ||
PRIMARY KEY (col1,col2,col3), | ||
KEY key1 (col1,col2) USING BTREE | ||
) ENGINE=TokuDB DEFAULT CHARSET=latin1 PACK_KEYS=1 COMPRESSION=TOKUDB_LZMA; | ||
|
||
insert into t3 select 1300000000+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1400000000+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410799999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410899999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1410999999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411099999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411199999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411299999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411399999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411499999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411599999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411699999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411899999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1411999999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1412099999+a, 12345, 7890, 'data' from t2; | ||
insert into t3 select 1412199999+a, 12345, 7890, 'data' from t2; | ||
|
||
--echo # The following must use range(PRIMARY): | ||
explain | ||
select col1,col2,col3 | ||
from t3 | ||
where col1 <= 1410799999 | ||
order by col1 desc,col2 desc,col3 desc limit 1; | ||
|
||
--echo # The same query but the constant is bigger. | ||
--echo # The query should use range(PRIMARY), not full index scan: | ||
explain | ||
select col1,col2,col3 | ||
from t3 | ||
where col1 <= 1412199999 | ||
order by col1 desc, col2 desc, col3 desc limit 1; | ||
|
||
drop table t1,t2,t3; | ||
|