diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-05 20:33:10 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-05 20:33:10 +0300 |
commit | 2c3c851d2cba73825f81cd06220138b15c17ae4d (patch) | |
tree | 4130cf52868c41beb3c242ad229031cca73d7e1c /mysql-test/main/key.result | |
parent | 474290540a829edcc6a74be8c354053f330bf5de (diff) | |
parent | 8648b9bed86e9f52c027daec760d6ab5ce52e889 (diff) | |
download | mariadb-git-2c3c851d2cba73825f81cd06220138b15c17ae4d.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/main/key.result')
-rw-r--r-- | mysql-test/main/key.result | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index 12f6c36edd8..3139caa9ae5 100644 --- a/mysql-test/main/key.result +++ b/mysql-test/main/key.result @@ -643,3 +643,45 @@ SHOW STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 14.199000 DROP TABLE t1; +# +# MDEV-21480: Unique key using ref access though eq_ref access can be used +# +create table t1(a int, b int,c int, primary key(a), unique key(b,c)); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2(a int, b int,c int); +insert into t2 select seq, seq, seq+1 from seq_1_to_100; +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 eq_ref b b 10 test.t2.a,test.t2.b 1 Using index +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +c c +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +10 11 +alter table t1 drop PRIMARY KEY; +alter table t1 add PRIMARY KEY(b,c); +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +c c +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +10 11 +drop table t1,t2; |