1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2020-05-05 20:33:10 +03:00
165 changed files with 4191 additions and 3448 deletions

View File

@ -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;