You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#25516986 ORDER_BY_XXX TESTS FAIL WHEN CHANGING DEFAULT CHARACTER SET
To repeat:
./mtr --mem --charset-for-testdb=utf8mb4
order_by_all
order_by_icp_mrr
order_by_none
order_by_sortkey
Fix: re-record with explicit charset for queries/tables with mismatch
in explain output.
Also fix:
ds_mrr-big --big-test, use latin1 because utf8mb4 gave plan change.
Also fix: derived, use utf8mb4 except in cases with execution plan changes.
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
299
299
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
300
-
1 SIMPLE t1 NULL range a a 22 NULL 2 100.00 Using where; Backward index scan; Using index
300
+
1 SIMPLE t1 NULL range a a 52 NULL 2 100.00 Using where; Backward index scan; Using index
301
301
Warnings:
302
-
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`c` = 'b') and (`test`.`t1`.`a` = 1) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`a` > 2)) order by `test`.`t1`.`a` desc
302
+
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a` = 1) and isnull(`test`.`t1`.`b`) and (`test`.`t1`.`c` = 'b')) or (`test`.`t1`.`a` > 2)) order by `test`.`t1`.`a` desc
303
303
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
304
304
a b c
305
305
1 NULL b
@@ -314,7 +314,7 @@ EXPLAIN
314
314
"query_block": {
315
315
"select_id": 1,
316
316
"cost_info": {
317
-
"query_cost": "2.38"
317
+
"query_cost": "2.51"
318
318
},
319
319
"ordering_operation": {
320
320
"using_filesort": false,
@@ -335,10 +335,10 @@ EXPLAIN
335
335
"backward_index_scan": true,
336
336
"using_index": true,
337
337
"cost_info": {
338
-
"read_cost": "1.38",
338
+
"read_cost": "1.51",
339
339
"eval_cost": "1.00",
340
-
"prefix_cost": "2.38",
341
-
"data_read_per_join": "240"
340
+
"prefix_cost": "2.51",
341
+
"data_read_per_join": "560"
342
342
},
343
343
"used_columns": [
344
344
"a",
@@ -439,7 +439,7 @@ Warning 1265 Data truncated for column 'b' at row 2
439
439
Warning 1265 Data truncated for column 'c' at row 3
440
440
explain select * from t1 order by a, b, c;
441
441
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
442
-
1 SIMPLE t1 NULL index NULL a 20 NULL 11 100.00 Using index
442
+
1 SIMPLE t1 NULL index NULL a 50 NULL 11 100.00 Using index
443
443
Warnings:
444
444
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` order by `test`.`t1`.`a`,`test`.`t1`.`b`,`test`.`t1`.`c`
445
445
select * from t1 order by a, b, c;
@@ -457,7 +457,7 @@ a b c
457
457
2 3 c
458
458
explain select * from t1 order by a desc, b desc, c desc;
459
459
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
460
-
1 SIMPLE t1 NULL index NULL a 20 NULL 11 100.00 Backward index scan; Using index
460
+
1 SIMPLE t1 NULL index NULL a 50 NULL 11 100.00 Backward index scan; Using index
461
461
Warnings:
462
462
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc,`test`.`t1`.`c` desc
463
463
select * from t1 order by a desc, b desc, c desc;
@@ -475,9 +475,9 @@ a b c
475
475
1 0
476
476
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
477
477
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
478
-
1 SIMPLE t1 NULL range a a 20 NULL 3 100.00 Using where; Backward index scan; Using index
478
+
1 SIMPLE t1 NULL range a a 50 NULL 3 100.00 Using where; Backward index scan; Using index
479
479
Warnings:
480
-
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`c` = 'b') and (`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1)) or (`test`.`t1`.`a` > 2)) order by `test`.`t1`.`a` desc
480
+
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1) and (`test`.`t1`.`c` = 'b')) or (`test`.`t1`.`a` > 2)) order by `test`.`t1`.`a` desc
481
481
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
482
482
a b c
483
483
1 1 b
@@ -693,11 +693,11 @@ StringVal mediumtext,
693
693
KEY FieldKey (FieldKey),
694
694
KEY LongField (FieldKey,LongVal),
695
695
KEY StringField (FieldKey,StringVal(32))
696
-
);
696
+
) charset utf8mb4;
697
697
INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
698
698
EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
699
699
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
700
-
1 SIMPLE t1 NULL ref FieldKey,LongField,StringField LongField 38 const 3 100.00 Using index condition
700
+
1 SIMPLE t1 NULL ref FieldKey,LongField,StringField LongField 146 const 3 100.00 Using index condition
701
701
Warnings:
702
702
Note 1003 /* select#1 */ select `test`.`t1`.`FieldKey` AS `FieldKey`,`test`.`t1`.`LongVal` AS `LongVal`,`test`.`t1`.`StringVal` AS `StringVal` from `test`.`t1` where (`test`.`t1`.`FieldKey` = '1') order by `test`.`t1`.`LongVal`
703
703
SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
@@ -707,7 +707,7 @@ FieldKey LongVal StringVal
707
707
1 2 1
708
708
EXPLAIN SELECT * FROM t1 ignore index (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
709
709
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
710
-
1 SIMPLE t1 NULL range StringField StringField 38 NULL 4 100.00 Using where; Using filesort
710
+
1 SIMPLE t1 NULL range StringField StringField 146 NULL 4 100.00 Using where; Using filesort
711
711
Warnings:
712
712
Note 1003 /* select#1 */ select `test`.`t1`.`FieldKey` AS `FieldKey`,`test`.`t1`.`LongVal` AS `LongVal`,`test`.`t1`.`StringVal` AS `StringVal` from `test`.`t1` IGNORE INDEX (`LongField`) IGNORE INDEX (`FieldKey`) where (`test`.`t1`.`FieldKey` > '2') order by `test`.`t1`.`LongVal`
713
713
SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
@@ -717,7 +717,7 @@ FieldKey LongVal StringVal
717
717
3 3 3
718
718
EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
719
719
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
720
-
1 SIMPLE t1 NULL range FieldKey,LongField,StringField LongField 38 NULL 4 100.00 Using index condition
720
+
1 SIMPLE t1 NULL range FieldKey,LongField,StringField LongField 146 NULL 4 100.00 Using index condition
721
721
Warnings:
722
722
Note 1003 /* select#1 */ select `test`.`t1`.`FieldKey` AS `FieldKey`,`test`.`t1`.`LongVal` AS `LongVal`,`test`.`t1`.`StringVal` AS `StringVal` from `test`.`t1` where (`test`.`t1`.`FieldKey` > '2') order by `test`.`t1`.`FieldKey`,`test`.`t1`.`LongVal`
723
723
SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
@@ -853,7 +853,7 @@ col2 col col
853
853
2 2 2
854
854
1 3 3
855
855
drop table t1, t2;
856
-
create table t1 (a char(25));
856
+
create table t1 (a char(25)) charset latin1;
857
857
insert into t1 set a = repeat('x', 20);
858
858
insert into t1 set a = concat(repeat('x', 19), 'z');
859
859
insert into t1 set a = concat(repeat('x', 19), 'ab');
@@ -1883,19 +1883,21 @@ col
1883
1883
DROP TABLE t1;
1884
1884
End of 5.0 tests
1885
1885
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
1886
-
UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
1887
-
CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
1888
-
CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b));
1886
+
UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c)) charset utf8mb4;
1887
+
CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b))
1888
+
charset utf8mb4;
1889
+
CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b))
1890
+
charset utf8mb4;
1889
1891
INSERT INTO t3 SELECT * FROM t1;
1890
1892
EXPLAIN
1891
1893
SELECT d FROM t1, t2
1892
1894
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
1893
1895
ORDER BY t2.c LIMIT 1;
1894
1896
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1895
-
1 SIMPLE t1 NULL ref a,b b 4 const 4 100.00 Using where; Using temporary; Using filesort
1896
-
1 SIMPLE t2 NULL ref a,b,c a 40 test.t1.a,const 11 79.85 Using index condition
1897
+
1 SIMPLE t1 NULL ref a,b b 13 const 3 100.00 Using where; Using temporary; Using filesort
1898
+
1 SIMPLE t2 NULL ref a,b,c a 136 test.t1.a,const 11 79.85 Using index condition
1897
1899
Warnings:
1898
-
Note 1003 /* select#1 */ select `test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`b` = 'DE') and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 14) and (5.1 < `test`.`t2`.`c`)) order by `test`.`t2`.`c` limit 1
1900
+
Note 1003 /* select#1 */ select `test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 14) and (5.1 < `test`.`t2`.`c`) and (`test`.`t1`.`b` = 'DE')) order by `test`.`t2`.`c` limit 1
1899
1901
SELECT d FROM t1, t2
1900
1902
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
1901
1903
ORDER BY t2.c LIMIT 1;
@@ -1907,9 +1909,9 @@ WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
1907
1909
ORDER BY t2.c LIMIT 1;
1908
1910
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1909
1911
1 SIMPLE t2 NULL range a,b,c c 5 NULL 420 26.43 Using index condition; Using where
1910
-
1 SIMPLE t1 NULL ref a a 39 test.t2.a,const 10 100.00 Using index
1912
+
1 SIMPLE t1 NULL ref a a 144 test.t2.a,const 10 100.00 Using index
1911
1913
Warnings:
1912
-
Note 1003 /* select#1 */ select `test`.`t2`.`d` AS `d` from `test`.`t3` `t1` join `test`.`t2` where ((`test`.`t1`.`b` = 'DE') and (`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t2`.`b` = 14) and (5.1 < `test`.`t2`.`c`)) order by `test`.`t2`.`c` limit 1
1914
+
Note 1003 /* select#1 */ select `test`.`t2`.`d` AS `d` from `test`.`t3` `t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t2`.`b` = 14) and (5.1 < `test`.`t2`.`c`) and (`test`.`t1`.`b` = 'DE')) order by `test`.`t2`.`c` limit 1
1913
1915
SELECT d FROM t3 AS t1, t2 AS t2
1914
1916
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
1915
1917
ORDER BY t2.c LIMIT 1;
@@ -1919,7 +1921,7 @@ DROP TABLE t1,t2,t3;
1919
1921
#
1920
1922
# WL#1393 - Optimizing filesort with small limit
1921
1923
#
1922
-
CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
1924
+
CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200)) charset latin1;
0 commit comments