You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
@@ -2029,7 +2030,7 @@ EXECUTE stmt;
2029
2030
b b a b
2030
2031
10 10 0 10
2031
2032
DEALLOCATE PREPARE stmt;
2032
-
SET SESSION join_cache_level=default;
2033
+
SET SESSION join_cache_level=@save_join_cache_level;
2033
2034
DROP TABLE t1,t2,t3;
2034
2035
#
2035
2036
# LP bug #943543: LEFT JOIN converted to JOIN with
@@ -2086,34 +2087,34 @@ WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
2086
2087
ORDER BY t1.b;
2087
2088
id select_type table type possible_keys key key_len ref rows filtered Extra
2088
2089
1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where
2089
-
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
2090
+
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
2090
2091
Warnings:
2091
2092
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b`
2092
2093
SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a
2093
2094
WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
2094
2095
ORDER BY t1.b;
2095
2096
b c d
2096
2097
5 8 88
2097
-
5 8 81
2098
2098
5 8 88
2099
2099
5 8 81
2100
+
5 8 81
2100
2101
EXPLAIN EXTENDED
2101
2102
SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
2102
2103
WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
2103
2104
ORDER BY t1.b;
2104
2105
id select_type table type possible_keys key key_len ref rows filtered Extra
2105
2106
1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where
2106
-
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
2107
+
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
2107
2108
Warnings:
2108
2109
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b`
2109
2110
SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
2110
2111
WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
2111
2112
ORDER BY t1.b;
2112
2113
b c d
2113
2114
5 8 88
2114
-
5 8 81
2115
2115
5 8 88
2116
2116
5 8 81
2117
+
5 8 81
2117
2118
DROP TABLE t1,t2;
2118
2119
#
2119
2120
# Bug mdev-4336: LEFT JOIN with disjunctive
@@ -2229,10 +2230,10 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
2229
2230
WHERE d3 IS NULL;
2230
2231
id select_type table type possible_keys key key_len ref rows filtered Extra
2231
2232
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
2232
-
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2233
-
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
2233
+
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (flat, BNLH join)
2234
+
1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (incremental, BNLH join)
2234
2235
Warnings:
2235
-
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
2236
+
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1` and `test`.`t1`.`i1` is not null and `test`.`t1`.`i1` is not null) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
2236
2237
DROP TABLE t1,t2,t3;
2237
2238
#
2238
2239
# Bug mdev-6705: wrong on expression after constant row substitution
@@ -2250,9 +2251,9 @@ WHERE b IN (1,2,3) OR b = d;
2250
2251
id select_type table type possible_keys key key_len ref rows filtered Extra
2251
2252
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
2252
2253
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2253
-
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2254
+
1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 const 2 100.00 Using where; Using join buffer (flat, BNLH join)
2254
2255
Warnings:
2255
-
Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
2256
+
Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10 and 10 is not null) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
2256
2257
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
2257
2258
WHERE b IN (1,2,3) OR b = d;
2258
2259
a b c d
@@ -2279,11 +2280,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2279
2280
explain select * from t1 left join t2 on t2.b is null;
2280
2281
id select_type table type possible_keys key key_len ref rows Extra
2281
2282
1 SIMPLE t1 ALL NULL NULL NULL NULL 9
2282
-
1 SIMPLE t2 ref b b 5 const 780 Using where
2283
+
1 SIMPLE t2 ref b b 5 const 780 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
2283
2284
explain select * from t1 left join t2 on t2.c is null;
2284
2285
id select_type table type possible_keys key key_len ref rows Extra
2285
2286
1 SIMPLE t1 ALL NULL NULL NULL NULL 9
2286
-
1 SIMPLE t2 ref c c 5 const 393 Using where
2287
+
1 SIMPLE t2 ref c c 5 const 393 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
2287
2288
drop table t1,t2;
2288
2289
#
2289
2290
# MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause
@@ -2325,8 +2326,8 @@ LEFT JOIN t3 on t2.i2 = t3.i3
2325
2326
WHERE v3 = 4;
2326
2327
id select_type table type possible_keys key key_len ref rows filtered Extra
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
2332
2333
# This should have the same join order like the query above:
@@ -2343,8 +2344,8 @@ AND 1 = 1
2343
2344
WHERE v3 = 4;
2344
2345
id select_type table type possible_keys key key_len ref rows filtered Extra
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
2350
2351
drop table t1,t2,t3;
@@ -2367,9 +2368,9 @@ ON t1.x = t2.x
2367
2368
WHERE IFNULL(t2.x,0)=0;
2368
2369
id select_type table type possible_keys key key_len ref rows filtered Extra
2369
2370
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
2370
-
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2371
+
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
2371
2372
Warnings:
2372
-
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`t2`.`x`,0) = 0
2373
+
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where ifnull(`test`.`t2`.`x`,0) = 0
2373
2374
SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
2374
2375
FROM t t1 LEFT JOIN t t2
2375
2376
ON t1.x = t2.x
@@ -2383,9 +2384,9 @@ ON t1.x = t2.x
2383
2384
WHERE f(t2.x,0)=0;
2384
2385
id select_type table type possible_keys key key_len ref rows filtered Extra
2385
2386
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
2386
-
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2387
+
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
2387
2388
Warnings:
2388
-
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
2389
+
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where `f`(`test`.`t2`.`x`,0) = 0
2389
2390
drop function f;
2390
2391
drop table t;
2391
2392
CREATE TABLE t1 (
@@ -2423,9 +2424,9 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
2423
2424
WHERE IFNULL(t2.col3,0) = 0;
2424
2425
id select_type table type possible_keys key key_len ref rows filtered Extra
2425
2426
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
2426
-
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2427
+
1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
2427
2428
Warnings:
2428
-
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
2429
+
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where ifnull(`test`.`t2`.`col3`,0) = 0
2429
2430
SELECT t1.col1, t2.col1, t2.col3
2430
2431
FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
2431
2432
WHERE f1(t2.col3,0) = 0;
@@ -2437,9 +2438,9 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
2437
2438
WHERE f1(t2.col3,0) = 0;
2438
2439
id select_type table type possible_keys key key_len ref rows filtered Extra
2439
2440
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
2440
-
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
2441
+
1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
2441
2442
Warnings:
2442
-
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
2443
+
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where `f1`(`test`.`t2`.`col3`,0) = 0
0 commit comments