Commit cb76bcb8 authored by Sergey Petrunya's avatar Sergey Petrunya

Stabilize a testcase after fix for BUG#784723

parent 3186341c
...@@ -295,6 +295,8 @@ Percentage float(3,1) NOT NULL default '0.0', ...@@ -295,6 +295,8 @@ Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language), PRIMARY KEY (Country, Language),
INDEX (Percentage) INDEX (Percentage)
); );
set @bug35674_save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
EXPLAIN EXPLAIN
SELECT Name FROM t2 SELECT Name FROM t2
WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000) WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000)
...@@ -303,10 +305,10 @@ t2.Code IN (SELECT Country FROM t3 ...@@ -303,10 +305,10 @@ t2.Code IN (SELECT Country FROM t3
WHERE Language='English' AND Percentage > 10 AND WHERE Language='English' AND Percentage > 10 AND
t2.Population > 100000); t2.Population > 100000);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 ALL unique_key NULL NULL NULL 1 1 PRIMARY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary
1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where 1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where
1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where 1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where; End temporary
2 SUBQUERY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan set optimizer_switch=@bug35674_save_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
Code char(3) NOT NULL DEFAULT '', Code char(3) NOT NULL DEFAULT '',
......
...@@ -302,6 +302,8 @@ Percentage float(3,1) NOT NULL default '0.0', ...@@ -302,6 +302,8 @@ Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language), PRIMARY KEY (Country, Language),
INDEX (Percentage) INDEX (Percentage)
); );
set @bug35674_save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
EXPLAIN EXPLAIN
SELECT Name FROM t2 SELECT Name FROM t2
WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000) WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000)
...@@ -310,10 +312,10 @@ t2.Code IN (SELECT Country FROM t3 ...@@ -310,10 +312,10 @@ t2.Code IN (SELECT Country FROM t3
WHERE Language='English' AND Percentage > 10 AND WHERE Language='English' AND Percentage > 10 AND
t2.Population > 100000); t2.Population > 100000);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 ALL unique_key NULL NULL NULL 1 1 PRIMARY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary
1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where; End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
2 SUBQUERY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan set optimizer_switch=@bug35674_save_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
Code char(3) NOT NULL DEFAULT '', Code char(3) NOT NULL DEFAULT '',
......
...@@ -229,6 +229,9 @@ INSERT INTO t3 VALUES ...@@ -229,6 +229,9 @@ INSERT INTO t3 VALUES
('BEL','Dutch',59.2),('BLZ','English',50.8); ('BEL','Dutch',59.2),('BLZ','English',50.8);
--enable_query_log --enable_query_log
# Disable materialization to avoid races between query plans
set @bug35674_save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
EXPLAIN EXPLAIN
SELECT Name FROM t2 SELECT Name FROM t2
WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000) WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000)
...@@ -236,6 +239,7 @@ SELECT Name FROM t2 ...@@ -236,6 +239,7 @@ SELECT Name FROM t2
t2.Code IN (SELECT Country FROM t3 t2.Code IN (SELECT Country FROM t3
WHERE Language='English' AND Percentage > 10 AND WHERE Language='English' AND Percentage > 10 AND
t2.Population > 100000); t2.Population > 100000);
set optimizer_switch=@bug35674_save_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment