1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.5' into 10.6

This commit is contained in:
Oleksandr Byelkin
2023-11-08 15:57:05 +01:00
381 changed files with 10233 additions and 5782 deletions

View File

@ -6270,5 +6270,131 @@ ERROR HY001: Could not create a join buffer. Please check and adjust the value o
SET JOIN_buffer_size=16384;
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
#
# MDEV-32351: Join buffer used for outer join with ON condition
# depending only on outer tables
#
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b)) ENGINE=MYISAM;
INSERT INTO t1 select seq from seq_1_to_10000;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ENGINE=MYISAM ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM ;
INSERT INTO t3 select seq from seq_1_to_3000;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM;
INSERT INTO t4 select seq from seq_1_to_3000;
ANALYZE TABLE t1,t2,t3,t4;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
set join_cache_level=0;
EXPLAIN SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10000 Using index
1 SIMPLE t2 ref b b 4 test.t1.b 1
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3000 Using where; Using index
SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
COUNT(*)
12999
set join_cache_level=default;
EXPLAIN SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10000 Using index
1 SIMPLE t2 ref b b 4 test.t1.b 1
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3000 Using where; Using index; Using join buffer (flat, BNL join)
SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
COUNT(*)
12999
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b));
INSERT INTO t1 select seq from seq_1_to_10;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t3 select seq from seq_1_to_3;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t4 select seq from seq_1_to_3;
set join_cache_level=0;
EXPLAIN SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10 Using index
1 SIMPLE t2 ALL b NULL NULL NULL 3 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3 Using where; Using index
SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
b b d c c
1 1 1 1 1
1 1 1 1 2
1 1 1 1 3
2 2 2 2 NULL
3 3 3 3 NULL
4 NULL NULL NULL NULL
5 NULL NULL NULL NULL
6 NULL NULL NULL NULL
7 NULL NULL NULL NULL
8 NULL NULL NULL NULL
9 NULL NULL NULL NULL
10 NULL NULL NULL NULL
set join_cache_level=default;
EXPLAIN SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10 Using index
1 SIMPLE t2 ALL b NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
b b d c c
1 1 1 1 1
1 1 1 1 2
1 1 1 1 3
2 2 2 2 NULL
3 3 3 3 NULL
4 NULL NULL NULL NULL
5 NULL NULL NULL NULL
6 NULL NULL NULL NULL
7 NULL NULL NULL NULL
8 NULL NULL NULL NULL
9 NULL NULL NULL NULL
10 NULL NULL NULL NULL
DROP TABLE t1,t2,t3,t4;
#
# End of 10.4 tests
#