summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj_mat.test
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-06-24 07:16:08 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2015-06-24 07:16:08 +0300
commit2e4984c185ddcd2da789017cd147338846ff409a (patch)
tree0293831900c860600efbaa747ea886d9d1cbf5bd /mysql-test/t/subselect_sj_mat.test
parent792b53e80806df893ee62c9a1c1bd117114c8c6d (diff)
parenta6087e7dc1ef3561d8189c8db15e9591d0f9b520 (diff)
downloadmariadb-git-2e4984c185ddcd2da789017cd147338846ff409a.tar.gz
Merge tag 'mariadb-10.0.20' into 10.0-FusionIO10.0-FusionIO
Conflicts: storage/innobase/os/os0file.cc storage/xtradb/os/os0file.cc storage/xtradb/srv/srv0start.cc
Diffstat (limited to 'mysql-test/t/subselect_sj_mat.test')
-rw-r--r--mysql-test/t/subselect_sj_mat.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index 912e9d5befd..c34c805f90c 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1843,3 +1843,45 @@ drop database mysqltest4;
--echo # End of 5.5 tests
+--echo #
+--echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+--echo #
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+
+create table t3 as select * from t2 limit 1;
+
+--echo # The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+--echo # Sequential reads:
+--echo # 1K is read from t1
+--echo # 4K is read from t2
+--echo # 1K groups is read from the tmp. table
+--echo #
+--echo # Lookups:
+--echo # 4K lookups in group by table
+--echo # 1K lookups in temp.table
+--echo #
+--echo # Writes:
+--echo # 2x 1K writes to temporary tables (grouping table and subquery materialization table
+--echo #
+--echo # The point is that neither counter should be in the millions (this
+--echo # will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+
+drop table t0,t1,t2,t3;