diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2014-06-25 16:01:09 +0400 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2014-06-25 16:01:09 +0400 |
commit | b561a98a87c0326dce59eb49c1b4b8f31da21d1e (patch) | |
tree | 573cd0a48bfda9441ddf0c1ba2aa7bd7989d2b94 /mysql-test/r/analyze_stmt.result | |
parent | 7711999d8b89d9bcf394e78a79c3c25013e249d6 (diff) | |
download | mariadb-git-b561a98a87c0326dce59eb49c1b4b8f31da21d1e.tar.gz |
MDEV-406: ANALYZE $stmt: add some tests for joins
Diffstat (limited to 'mysql-test/r/analyze_stmt.result')
-rw-r--r-- | mysql-test/r/analyze_stmt.result | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/mysql-test/r/analyze_stmt.result b/mysql-test/r/analyze_stmt.result index adce561c910..bf005801431 100644 --- a/mysql-test/r/analyze_stmt.result +++ b/mysql-test/r/analyze_stmt.result @@ -115,5 +115,35 @@ analyze select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10 100.00 50.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 10.00 Using where; Using join buffer (flat, BNL join) -drop table t0,t1; # TODO: Check what is counted for "range checked for each record". +# +# Test for joins +# +create table t2 (key1 int, key2x int, col1 int, key(key1), key(key2x)); +insert into t2 select A.a + 10 *B.a +100 * C.a, +(A.a + 10 *B.a +100 * C.a)*2, +A.a + 10 *B.a +100 * C.a +from t0 A, t0 B, t0 C; +# This always has matches, filtered=100%. +analyze select * from t1,t2 where t2.key1=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where +1 SIMPLE t2 ref key1 key1 5 test.t1.a 1 1 100.00 100.00 +# This shows r_rows=0. It is actually 0.5 (should r_rows be changed to double?) +analyze select * from t1,t2 where t2.key2x=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where +1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0 100.00 100.00 +select * from t1,t2 where t2.key2x=t1.a; +a b key1 key2x col1 +0 0 0 0 0 +2 2 1 2 1 +4 4 2 4 2 +6 6 3 6 3 +8 8 4 8 4 +# This has t2.filtered=40% (there are 5 values: {0,1,2,3,4}. two of them have mod=0) +analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where +1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0 100.00 40.00 Using where +drop table t0,t1,t2; |