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
Copy file name to clipboardExpand all lines: mysql-test/r/limit_rows_examined.result
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -426,7 +426,7 @@ c1
426
426
bb
427
427
cc
428
428
Warnings:
429
-
Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete.
429
+
Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete.
430
430
select * from v1 LIMIT ROWS EXAMINED 11;
431
431
c1
432
432
bb
@@ -439,7 +439,8 @@ from (select * from t1
439
439
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
440
440
LIMIT ROWS EXAMINED 11;
441
441
id select_type table type possible_keys key key_len ref rows Extra
442
-
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_mat_cost_bugs.result
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -379,6 +379,7 @@ drop table t3, t4, t5;
379
379
#
380
380
# LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
381
381
#
382
+
set @optimizer_switch_save= @@optimizer_switch;
382
383
create table t1 (c1 char(2) not null, c2 char(2));
383
384
create table t2 (c3 char(2), c4 char(2));
384
385
insert into t1 values ('a1', 'b1');
@@ -400,6 +401,7 @@ id select_type table type possible_keys key key_len ref rows Extra
400
401
select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
401
402
c1 c2
402
403
drop table t1, t2;
404
+
set optimizer_switch= @optimizer_switch_save;
403
405
#
404
406
# MDEV-12673: cost-based choice between materialization and in-to-exists
405
407
#
@@ -442,3 +444,44 @@ id select_type table type possible_keys key key_len ref rows Extra
442
444
2 DEPENDENT SUBQUERY t3 const PRIMARY PRIMARY 4 const 1
443
445
2 DEPENDENT SUBQUERY t2 index NULL i2 11 NULL 2 Using where; Using index
444
446
DROP TABLE t1,t2,t3;
447
+
#
448
+
# MDEV-7599: in-to-exists chosen after min/max optimization
449
+
#
450
+
set @optimizer_switch_save= @@optimizer_switch;
451
+
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
452
+
INSERT INTO t1 VALUES (1),(2);
453
+
CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
454
+
INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
455
+
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
456
+
b c
457
+
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
458
+
id select_type table type possible_keys key key_len ref rows filtered Extra
459
+
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
460
+
2 MATERIALIZED t1 index NULL a 5 NULL 2 100.00 Using index
461
+
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
462
+
Warnings:
463
+
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (not(<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`b`) ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where ((`test`.`t2`.`b` = `<subquery2>`.`MIN(a)`))))))))
464
+
set optimizer_switch= 'materialization=off';
465
+
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
466
+
b c
467
+
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
468
+
id select_type table type possible_keys key key_len ref rows filtered Extra
469
+
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
470
+
2 DEPENDENT SUBQUERY t1 index NULL a 5 NULL 2 100.00 Using index
471
+
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
472
+
Warnings:
473
+
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (not(<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`b`) having trigcond((<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`)))))))))
0 commit comments