diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/subselect_mat.result | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 4d02e5012e2..da4a3a1c847 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1861,6 +1861,24 @@ WHERE 'condition'='impossible' MIN(a) NULL DROP TABLE t1; +# +# BUG#938131: Subquery materialization is not used in CREATE TABLE SELECT +# +CREATE TABLE t1(a int); +INSERT INTO t1 values(1),(2); +CREATE TABLE t2(a int); +INSERT INTO t2 values(1),(2); +# Should use Materialization: +EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using temporary +flush status; +CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); +SHOW STATUS LIKE 'Created_tmp_tables'; +Variable_name Value +Created_tmp_tables 3 +DROP TABLE t1,t2,t3; # This must be at the end: set optimizer_switch=@subselect_sj_mat_tmp; set join_cache_level=@save_join_cache_level; |