summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/cte_recursive.result18
-rw-r--r--mysql-test/main/delete.result6
-rw-r--r--mysql-test/main/derived_cond_pushdown.result39
-rw-r--r--mysql-test/main/derived_split_innodb.result8
-rw-r--r--mysql-test/main/derived_view.result24
-rw-r--r--mysql-test/main/distinct.result2
-rw-r--r--mysql-test/main/fetch_first.result12
-rw-r--r--mysql-test/main/fetch_first.test1
-rw-r--r--mysql-test/main/greedy_optimizer.result84
-rw-r--r--mysql-test/main/innodb_ext_key.result2
-rw-r--r--mysql-test/main/innodb_icp.result2
-rw-r--r--mysql-test/main/join.result4
-rw-r--r--mysql-test/main/join_cache.result16
-rw-r--r--mysql-test/main/join_outer_jcl6.result4
-rw-r--r--mysql-test/main/key.result6
-rw-r--r--mysql-test/main/limit_rows_examined.result6
-rw-r--r--mysql-test/main/myisam_explain_non_select_all.result40
-rw-r--r--mysql-test/main/null_key.result4
-rw-r--r--mysql-test/main/opt_trace.result1377
-rw-r--r--mysql-test/main/opt_trace_index_merge.result3
-rw-r--r--mysql-test/main/opt_trace_index_merge_innodb.result11
-rw-r--r--mysql-test/main/opt_trace_security.result18
-rw-r--r--mysql-test/main/opt_trace_selectivity.result24
-rw-r--r--mysql-test/main/opt_tvc.result40
-rw-r--r--mysql-test/main/order_by.result4
-rw-r--r--mysql-test/main/partition_pruning.result2
-rw-r--r--mysql-test/main/rowid_filter.result188
-rw-r--r--mysql-test/main/rowid_filter_innodb.result64
-rw-r--r--mysql-test/main/rowid_filter_innodb_debug.test2
-rw-r--r--mysql-test/main/select.result10
-rw-r--r--mysql-test/main/select_jcl6.result10
-rw-r--r--mysql-test/main/select_pkeycache.result10
-rw-r--r--mysql-test/main/selectivity.result10
-rw-r--r--mysql-test/main/selectivity_innodb.result6
-rw-r--r--mysql-test/main/single_delete_update.result24
-rw-r--r--mysql-test/main/stat_tables.result8
-rw-r--r--mysql-test/main/status.result10
-rw-r--r--mysql-test/main/subselect.result18
-rw-r--r--mysql-test/main/subselect2.result2
-rw-r--r--mysql-test/main/subselect3.result2
-rw-r--r--mysql-test/main/subselect3_jcl6.result2
-rw-r--r--mysql-test/main/subselect4.result8
-rw-r--r--mysql-test/main/subselect_exists2in.result4
-rw-r--r--mysql-test/main/subselect_innodb.result4
-rw-r--r--mysql-test/main/subselect_mat.result18
-rw-r--r--mysql-test/main/subselect_mat_cost_bugs.result4
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result18
-rw-r--r--mysql-test/main/subselect_no_mat.result10
-rw-r--r--mysql-test/main/subselect_no_opts.result4
-rw-r--r--mysql-test/main/subselect_no_scache.result18
-rw-r--r--mysql-test/main/subselect_no_semijoin.result4
-rw-r--r--mysql-test/main/subselect_sj.result62
-rw-r--r--mysql-test/main/subselect_sj2.result11
-rw-r--r--mysql-test/main/subselect_sj2_jcl6.result19
-rw-r--r--mysql-test/main/subselect_sj2_mat.result37
-rw-r--r--mysql-test/main/subselect_sj_jcl6.result56
-rw-r--r--mysql-test/main/subselect_sj_mat.result24
-rw-r--r--mysql-test/main/table_elim.result2
-rw-r--r--mysql-test/main/type_time_6065.result2
-rw-r--r--mysql-test/main/union.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result4
-rw-r--r--mysql-test/suite/maria/mrr.result4
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_myisam.result4
-rw-r--r--sql/opt_trace.cc4
-rw-r--r--sql/rowid_filter.cc1
-rw-r--r--sql/rowid_filter.h7
-rw-r--r--sql/sql_select.cc338
-rw-r--r--storage/connect/mysql-test/connect/r/index.result8
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join_nullable.result2
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result2
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join_nullable.result2
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result2
72 files changed, 1438 insertions, 1370 deletions
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index deb787f20fd..a754b923ecf 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -692,14 +692,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00
1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00
3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
-4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
-4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
-5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
-5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
+4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00
+4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 75.00 Using where; Using join buffer (flat, BNL join)
+5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00
+5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 75.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
Warnings:
-Note 1003 with recursive ancestor_couple_ids(`h_id`,`w_id`) as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors(`id`,`name`,`dob`,`father`,`mother`) as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
+Note 1003 with recursive ancestor_couple_ids(`h_id`,`w_id`) as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors(`id`,`name`,`dob`,`father`,`mother`) as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `fa`.`h_id` = `test`.`p`.`id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `ma`.`w_id` = `test`.`p`.`id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
# simple mutual recursion
with recursive
ancestor_couple_ids(h_id, w_id)
@@ -3260,10 +3260,10 @@ ORDER BY path;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 15 Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 15 Using where
-3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15
-3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
-4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15
-4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
+3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
+3 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
+4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
+4 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
DROP TABLE t1,t2;
set tmp_memory_table_size=default;
diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result
index 5bca2bd5ec2..ed3683d52f9 100644
--- a/mysql-test/main/delete.result
+++ b/mysql-test/main/delete.result
@@ -205,13 +205,13 @@ insert into t3 values (1,1),(2,1),(1,3);
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
a b a b a b
1 1 1 1 1 1
-1 3 1 1 1 3
2 1 2 2 2 1
+1 3 1 1 1 3
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
-1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 Using index
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
select * from t3;
a b
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index b27169d60ce..a17580d9943 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -17764,10 +17764,10 @@ from t1 left join
on t1.a=t.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00
-1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00 Using where
-2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 Using where
+2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1
explain format=json select t1.a,t.max,t.min
from t1 left join
(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t
@@ -17795,28 +17795,29 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.a"],
- "rows": 9,
+ "rows": 2,
"filtered": 100,
"attached_condition": "trigcond(trigcond(t1.a is not null))",
"materialized": {
+ "lateral": 1,
"query_block": {
"select_id": 2,
- "filesort": {
- "sort_key": "t2.a",
- "temporary_table": {
- "nested_loop": [
- {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx_a"],
- "rows": 90,
- "filtered": 100
- }
- }
- ]
+ "outer_ref_condition": "t1.a is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100
+ }
}
- }
+ ]
}
}
}
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
index 74876836a53..7a680d3a0df 100644
--- a/mysql-test/main/derived_split_innodb.result
+++ b/mysql-test/main/derived_split_innodb.result
@@ -208,8 +208,8 @@ t2
where t1.id = dt.id and t1.itemid = dt.itemid and t2.id=t1.itemid;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 1
-1 PRIMARY <derived2> ref key1 key1 4 test.t2.id 2
-1 PRIMARY t1 ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ref idx idx 4 test.t2.id 1
+1 PRIMARY <derived2> ref key0 key0 9 test.t2.id,test.t1.id 2
2 DERIVED t3 ref idx1,idx2 idx1 4 const 5 Using where; Using index
select t1.id, t1.itemid, dt.id, t2.id
from t1,
@@ -227,8 +227,8 @@ t2
where t1.id = dt.id and t1.itemid = dt.itemid and t2.id=t1.itemid;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 1
-1 PRIMARY <derived2> ref key1 key1 4 test.t2.id 2
-1 PRIMARY t1 ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ref idx idx 4 test.t2.id 1
+1 PRIMARY <derived2> ref key0 key0 9 test.t2.id,test.t1.id 2
2 DERIVED t3 ref idx1 idx1 4 const 5 Using where; Using index
select t1.id, t1.itemid, dt.id, t2.id
from t1,
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 916fd71b92e..b86cd1c42cc 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -2044,10 +2044,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t5 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ref e e 3 test.t2.d 1 Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 index e e 7 NULL 8 Using where; Using index; Using join buffer (flat, BNL join)
SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3;
d
+w
+w
+w
+w
+w
+w
d
d
d
@@ -2066,12 +2072,6 @@ e
e
e
e
-w
-w
-w
-w
-w
-w
SET SESSION join_cache_level = @exit_join_cache_level;
SET SESSION join_buffer_size = @exit_join_buffer_size;
DROP VIEW v3;
@@ -2459,8 +2459,6 @@ SELECT * FROM t1;
a
1
1
-1
-1
drop table t1,t2;
set optimizer_switch=@save968720_optimizer_switch;
#
@@ -2597,8 +2595,8 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
EXPLAIN EXTENDED
SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 /* select#1 */ select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` and `v1`.`c2` = `test`.`t2`.`c2`
@@ -2610,8 +2608,8 @@ EXPLAIN EXTENDED
SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
WHERE t.g=t2.c1 AND t.m=t2.c2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (/* select#2 */ select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where `t`.`g` = `test`.`t2`.`c1` and `t`.`m` = `test`.`t2`.`c2`
diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result
index 92443d0f0e3..b422d3b286e 100644
--- a/mysql-test/main/distinct.result
+++ b/mysql-test/main/distinct.result
@@ -523,7 +523,7 @@ EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
WHERE t1_1.a = t1_2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1_1 ALL PRIMARY NULL NULL NULL 3 Using temporary
-1 SIMPLE t1_2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t1_2 eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 Using index; Distinct
EXPLAIN SELECT a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result
index 69a0336d722..c2aacbf3687 100644
--- a/mysql-test/main/fetch_first.result
+++ b/mysql-test/main/fetch_first.result
@@ -1007,12 +1007,12 @@ id first_name last_name score
3 John Smith 6
select * from t1 order by first_name desc fetch first 3 rows with ties;
id first_name last_name score
-8 Silvia Ganush 10
-2 John Doe 6
-3 John Smith 6
-4 John Smith 6
-5 John Smith 7
-6 John Elton 8.1
+# Silvia # #
+# John # #
+# John # #
+# John # #
+# John # #
+# John # #
(select * from t1 order by 1 fetch first 3 rows with ties)
intersect
(select * from t1 order by first_name desc fetch first 3 rows with ties)
diff --git a/mysql-test/main/fetch_first.test b/mysql-test/main/fetch_first.test
index 62cdd717f81..0baf467fa5b 100644
--- a/mysql-test/main/fetch_first.test
+++ b/mysql-test/main/fetch_first.test
@@ -769,6 +769,7 @@ fetch first 1 row with ties;
--echo # Test union-like operator with multiple fetch first clauses.
--echo #
select * from t1 order by 1 fetch first 3 rows with ties;
+--replace_column 1 # 3 # 4 #
select * from t1 order by first_name desc fetch first 3 rows with ties;
--sorted_result
diff --git a/mysql-test/main/greedy_optimizer.result b/mysql-test/main/greedy_optimizer.result
index 5a5d24c973e..7e1220d3904 100644
--- a/mysql-test/main/greedy_optimizer.result
+++ b/mysql-test/main/greedy_optimizer.result
@@ -127,7 +127,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -139,7 +139,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -151,7 +151,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -163,7 +163,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -175,7 +175,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -187,7 +187,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
set optimizer_prune_level=0;
select @@optimizer_prune_level;
@@optimizer_prune_level
@@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1371.437037
+Last_query_cost 2705.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -219,7 +219,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1371.437037
+Last_query_cost 2705.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -231,7 +231,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -243,7 +243,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -255,7 +255,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -267,7 +267,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
set optimizer_search_depth=1;
select @@optimizer_search_depth;
@@optimizer_search_depth
@@ -283,7 +283,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -295,7 +295,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -307,7 +307,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -319,7 +319,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -331,7 +331,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -343,7 +343,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
set optimizer_search_depth=62;
select @@optimizer_search_depth;
@@optimizer_search_depth
@@ -359,7 +359,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1371.437037
+Last_query_cost 2705.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -371,7 +371,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1371.437037
+Last_query_cost 2705.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -383,7 +383,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -395,7 +395,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -407,7 +407,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
@@ -419,7 +419,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 362.618727
+Last_query_cost 701.018727
set optimizer_prune_level=2;
select @@optimizer_prune_level;
@@optimizer_prune_level
@@ -439,7 +439,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -451,7 +451,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -463,7 +463,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -475,7 +475,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -487,7 +487,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -499,7 +499,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
set optimizer_search_depth=1;
select @@optimizer_search_depth;
@@optimizer_search_depth
@@ -515,7 +515,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -527,7 +527,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -539,7 +539,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -551,7 +551,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -563,7 +563,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
@@ -575,7 +575,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 844.037037
+Last_query_cost 1678.037037
set optimizer_search_depth=62;
select @@optimizer_search_depth;
@@optimizer_search_depth
@@ -591,7 +591,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -603,7 +603,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 1693.637037
+Last_query_cost 3350.237037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -615,7 +615,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -627,7 +627,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -639,7 +639,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -651,7 +651,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 642.737037
+Last_query_cost 1276.787037
drop table t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a int, b int, d int, i int);
INSERT INTO t1 VALUES (1,1,1,1);
diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result
index 02e199bc58a..18a3d147bf3 100644
--- a/mysql-test/main/innodb_ext_key.result
+++ b/mysql-test/main/innodb_ext_key.result
@@ -339,8 +339,8 @@ a b
EXPLAIN
SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2);
id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
2 MATERIALIZED s1 ALL NULL NULL NULL NULL 2
2 MATERIALIZED s2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
DROP TABLE t1;
diff --git a/mysql-test/main/innodb_icp.result b/mysql-test/main/innodb_icp.result
index c89d49cad0c..e08faa142cf 100644
--- a/mysql-test/main/innodb_icp.result
+++ b/mysql-test/main/innodb_icp.result
@@ -414,7 +414,7 @@ WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240
ORDER BY c1
LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 4 Using where; Using index
+1 SIMPLE t1 range PRIMARY,k1 PRIMARY 4 NULL 3 Using where; Using filesort
DROP TABLE t1;
#
#
diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result
index e621197692a..8f75105c30d 100644
--- a/mysql-test/main/join.result
+++ b/mysql-test/main/join.result
@@ -892,7 +892,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 4.016090
+Last_query_cost 6.016090
select 'The cost of accessing t1 (dont care if it changes' '^';
The cost of accessing t1 (dont care if it changes
The cost of accessing t1 (dont care if it changes^
@@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE B eq_ref PRIMARY PRIMARY 4 test.A.b 1
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 28.016090
+Last_query_cost 34.016090
select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;
Z
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 1e649c193b6..3c9d1f020b9 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -3067,15 +3067,15 @@ t1.metaid = t2.metaid AND t1.affiliateid = '2';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 system PRIMARY NULL NULL NULL 1
1 SIMPLE t5 ref PRIMARY,t5_formattypeid t5_formattypeid 4 const 1
-1 SIMPLE t1 ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE t7 ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using index
-1 SIMPLE t8 eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE t9 index PRIMARY,t9_subgenreid,t9_metaid PRIMARY 8 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join)
+1 SIMPLE t9 index PRIMARY,t9_subgenreid,t9_metaid PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t9.metaid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t10 eq_ref PRIMARY,t10_genreid PRIMARY 4 test.t9.subgenreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE t3 ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaidformatid 4 test.t1.metaid 1 Using index condition; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t7 ref PRIMARY PRIMARY 4 test.t9.metaid 1 Using index
+1 SIMPLE t8 eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t3 ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaidformatid 4 test.t9.metaid 1 Using index condition; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t4 eq_ref PRIMARY,t4_formatclassid,t4_formats_idx PRIMARY 4 test.t3.formatid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t1 ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 2 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT t1.uniquekey, t1.xml AS affiliateXml,
t8.name AS artistName, t8.artistid,
t11.name AS genreName, t11.genreid, t11.priority AS genrePriority,
@@ -4507,8 +4507,8 @@ SET SESSION join_buffer_size = 256;
EXPLAIN
SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 36
-1 SIMPLE t2 ALL idx NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL idx NULL NULL NULL 15 Using where
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t2.a 36 Using where; Using join buffer (flat, BNLH join)
SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99;
a c
SET SESSION join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index 8dcc41638bb..7f2f6ae96d4 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -2783,8 +2783,8 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join)
+1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
#
# .. part 2: make sure condition selectivity can use the condition too.
#
diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result
index 2e2c8d894f0..091e8e44b82 100644
--- a/mysql-test/main/key.result
+++ b/mysql-test/main/key.result
@@ -628,19 +628,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 9.212184
+Last_query_cost 10.412184
EXPLAIN SELECT a, SUM( b ) FROM t1 USE INDEX( a ) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 9.212184
+Last_query_cost 10.412184
EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 6
SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 14.199000
+Last_query_cost 15.399000
DROP TABLE t1;
#
# MDEV-21480: Unique key using ref access though eq_ref access can be used
diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result
index abed46ff235..f0a22b8f3f2 100644
--- a/mysql-test/main/limit_rows_examined.result
+++ b/mysql-test/main/limit_rows_examined.result
@@ -49,10 +49,11 @@ explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index
-1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
+cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
set @@join_cache_level=6;
@@ -69,10 +70,11 @@ explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index
-1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
+cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Mix LIMIT ROWS EXAMINED with LIMIT
diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result
index 1c2deb32224..83e18f3906f 100644
--- a/mysql-test/main/myisam_explain_non_select_all.result
+++ b/mysql-test/main/myisam_explain_non_select_all.result
@@ -256,8 +256,8 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3
@@ -932,15 +932,15 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
EXPLAIN DELETE t1,t2,t3 FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 3 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED DELETE t1,t2,t3 FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 3 75.00 Using where
-1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 3 75.00 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 13
@@ -949,8 +949,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 3 75.00 Using where; Using index; Using join buffer (flat, BNL join)
-1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 75.00 Using where; Using index; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@@ -960,16 +960,16 @@ Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_first 2
-Handler_read_key 13
-Handler_read_next 6
+Handler_read_key 19
+Handler_read_next 3
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 8
-Handler_read_key 13
+Handler_read_key 19
+Handler_read_next 3
Handler_read_rnd 5
-Handler_read_rnd_next 28
+Handler_read_rnd_next 4
DROP TABLE t1, t2, t3;
#20
@@ -1507,7 +1507,7 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@@ -1517,11 +1517,9 @@ Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_first 1
Handler_read_key 8
-Handler_read_rnd_next 27
-Sort_priority_queue_sorts 1
-Sort_rows 1
-Sort_scan 1
+Handler_read_next 26
# Status of testing query execution:
Variable_name Value
Handler_delete 1
@@ -2024,7 +2022,7 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@@ -2034,11 +2032,9 @@ Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_first 1
Handler_read_key 8
-Handler_read_rnd_next 27
-Sort_priority_queue_sorts 1
-Sort_rows 1
-Sort_scan 1
+Handler_read_next 26
# Status of testing query execution:
Variable_name Value
Handler_read_key 8
diff --git a/mysql-test/main/null_key.result b/mysql-test/main/null_key.result
index 6b9d59c636a..d59a1cd0a2e 100644
--- a/mysql-test/main/null_key.result
+++ b/mysql-test/main/null_key.result
@@ -160,12 +160,12 @@ a b
7 NULL
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null a,b a 5 const 5 Using where; Using index
+1 SIMPLE t1 range a,b a 10 NULL 4 Using where; Using index
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
a b
+NULL 7
7 NULL
7 7
-NULL 7
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 33bf157ab3f..c859c1de513 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -135,14 +135,14 @@ select * from v1 {
{
"access_type": "scan",
"resulting_rows": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"uses_join_buffering": false
}
}
@@ -153,12 +153,13 @@ select * from v1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 2.404394531
+ "cost_for_plan": 2.604394531
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 2.603394531
},
{
"substitute_best_equal": {
@@ -293,14 +294,14 @@ select * from (select * from t1 where t1.a=1)q {
{
"access_type": "scan",
"resulting_rows": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"uses_join_buffering": false
}
}
@@ -311,12 +312,13 @@ select * from (select * from t1 where t1.a=1)q {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 2.404394531
+ "cost_for_plan": 2.604394531
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 2.603394531
},
{
"substitute_best_equal": {
@@ -456,7 +458,7 @@ select * from v2 {
{
"access_type": "scan",
"resulting_rows": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"chosen": true,
"use_tmp_table": true
}
@@ -464,7 +466,7 @@ select * from v2 {
"chosen_access_method": {
"type": "scan",
"records": 1,
- "cost": 2.204394531,
+ "cost": 2.404394531,
"uses_join_buffering": false
}
}
@@ -475,13 +477,14 @@ select * from v2 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 2.404394531,
+ "cost_for_plan": 2.604394531,
"cost_for_sorting": 1
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.603394531
},
{
"substitute_best_equal": {
@@ -536,14 +539,14 @@ select * from v2 {
{
"access_type": "scan",
"resulting_rows": 2,
- "cost": 2,
+ "cost": 2.4,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 2,
- "cost": 2,
+ "cost": 2.4,
"uses_join_buffering": false
}
}
@@ -554,12 +557,13 @@ select * from v2 {
"plan_prefix": [],
"table": "<derived2>",
"rows_for_plan": 2,
- "cost_for_plan": 2.4
+ "cost_for_plan": 2.8
}
]
},
{
- "best_join_order": ["<derived2>"]
+ "best_join_order": ["<derived2>"],
+ "cost": 2.799
},
{
"attaching_conditions_to_tables": {
@@ -680,14 +684,14 @@ explain select * from v2 {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"uses_join_buffering": false
}
}
@@ -698,12 +702,13 @@ explain select * from v2 {
"plan_prefix": [],
"table": "t2",
"rows_for_plan": 10,
- "cost_for_plan": 4.021972656
+ "cost_for_plan": 6.021972656
}
]
},
{
- "best_join_order": ["t2"]
+ "best_join_order": ["t2"],
+ "cost": 6.020972656
},
{
"attaching_conditions_to_tables": {
@@ -803,7 +808,7 @@ explain select * from v1 {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"chosen": true,
"use_tmp_table": true
}
@@ -811,7 +816,7 @@ explain select * from v1 {
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"uses_join_buffering": false
}
}
@@ -822,13 +827,14 @@ explain select * from v1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 10,
- "cost_for_plan": 4.021972656,
+ "cost_for_plan": 6.021972656,
"cost_for_sorting": 10
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 16.02097266
},
{
"attaching_conditions_to_tables": {
@@ -877,14 +883,14 @@ explain select * from v1 {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 10,
+ "cost": 12,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 10,
+ "cost": 12,
"uses_join_buffering": false
}
}
@@ -895,12 +901,13 @@ explain select * from v1 {
"plan_prefix": [],
"table": "<derived2>",
"rows_for_plan": 10,
- "cost_for_plan": 12
+ "cost_for_plan": 14
}
]
},
{
- "best_join_order": ["<derived2>"]
+ "best_join_order": ["<derived2>"],
+ "cost": 13.999
},
{
"attaching_conditions_to_tables": {
@@ -1056,14 +1063,14 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
{
"access_type": "scan",
"resulting_rows": 100,
- "cost": 2.317382812,
+ "cost": 22.31738281,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 100,
- "cost": 2.317382812,
+ "cost": 22.31738281,
"uses_join_buffering": false
}
}
@@ -1075,14 +1082,14 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
{
"access_type": "scan",
"resulting_rows": 100,
- "cost": 2.317382812,
+ "cost": 22.31738281,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 100,
- "cost": 2.317382812,
+ "cost": 22.31738281,
"uses_join_buffering": false
}
}
@@ -1093,7 +1100,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 100,
- "cost_for_plan": 22.31738281,
+ "cost_for_plan": 42.31738281,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -1107,22 +1114,23 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"index": "a",
"used_range_estimates": false,
"reason": "not available",
- "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
- "cost": 200.0585794,
+ "cond_check_cost": 2.200585794,
+ "startup_cost": 0,
+ "cost": 220.0585794,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 75,
- "cost": 7.317382812,
+ "cost": 1522.317383,
"chosen": false
}
],
"chosen_access_method": {
"type": "ref",
"records": 1,
- "cost": 200.0585794,
+ "cost": 220.0585794,
"uses_join_buffering": false
}
}
@@ -1133,7 +1141,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"plan_prefix": ["t1"],
"table": "t2",
"rows_for_plan": 100,
- "cost_for_plan": 242.3759623
+ "cost_for_plan": 282.3759623
}
]
},
@@ -1141,7 +1149,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"plan_prefix": [],
"table": "t2",
"rows_for_plan": 100,
- "cost_for_plan": 22.31738281,
+ "cost_for_plan": 42.31738281,
"rest_of_plan": [
{
"plan_prefix": ["t2"],
@@ -1155,22 +1163,23 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"index": "a",
"used_range_estimates": false,
"reason": "not available",
- "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
- "cost": 200.0585794,
+ "cond_check_cost": 2.200585794,
+ "startup_cost": 0,
+ "cost": 220.0585794,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 75,
- "cost": 7.317382812,
+ "cost": 1522.317383,
"chosen": false
}
],
"chosen_access_method": {
"type": "ref",
"records": 1,
- "cost": 200.0585794,
+ "cost": 220.0585794,
"uses_join_buffering": false
}
}
@@ -1181,17 +1190,18 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"plan_prefix": ["t2"],
"table": "t1",
"rows_for_plan": 100,
- "cost_for_plan": 242.3759623,
+ "cost_for_plan": 282.3759623,
"pruned_by_cost": true,
- "current_cost": 242.3759623,
- "best_cost": 242.3759623
+ "current_cost": 282.3759623,
+ "best_cost": 282.3759623
}
]
}
]
},
{
- "best_join_order": ["t1", "t2"]
+ "best_join_order": ["t1", "t2"],
+ "cost": 282.3749623
},
{
"substitute_best_equal": {
@@ -1372,7 +1382,8 @@ EXPLAIN SELECT DISTINCT a FROM t1 {
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 7.499
},
{
"attaching_conditions_to_tables": {
@@ -1546,7 +1557,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
{
"access_type": "scan",
"resulting_rows": 1,
- "cost": 3.229052734,
+ "cost": 3.429052734,
"chosen": true,
"use_tmp_table": true
}
@@ -1554,7 +1565,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"chosen_access_method": {
"type": "scan",
"records": 1,
- "cost": 3.229052734,
+ "cost": 3.429052734,
"uses_join_buffering": false
}
}
@@ -1565,13 +1576,14 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 3.429052734,
+ "cost_for_plan": 3.629052734,
"cost_for_sorting": 1
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 4.628052734
},
{
"substitute_best_equal": {
@@ -1594,7 +1606,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
- "read_time": 3.230052734,
+ "read_time": 3.430052734,
"table": "t1",
"rows_estimation": 7,
"possible_keys": [
@@ -1797,7 +1809,8 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 14.049
},
{
"substitute_best_equal": {
@@ -1992,7 +2005,8 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 14.049
},
{
"substitute_best_equal": {
@@ -2248,9 +2262,10 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"access_type": "ref",
"index": "a_c",
"used_range_estimates": true,
- "rowid_filter_skipped": "worst/max seeks clipping",
"rows": 180,
- "cost": 180.2743776,
+ "cond_check_cost": 216.2743776,
+ "startup_cost": 0,
+ "cost": 216.2743776,
"chosen": true
},
{
@@ -2258,7 +2273,9 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"index": "a_b",
"used_range_estimates": true,
"rows": 21,
- "cost": 21.14242739,
+ "cond_check_cost": 25.34242739,
+ "startup_cost": 0,
+ "cost": 25.34242739,
"chosen": true
},
{
@@ -2270,7 +2287,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"chosen_access_method": {
"type": "ref",
"records": 21,
- "cost": 21.14242739,
+ "cost": 25.34242739,
"uses_join_buffering": false
}
}
@@ -2281,12 +2298,13 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 21,
- "cost_for_plan": 25.34242739
+ "cost_for_plan": 29.54242739
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 29.54142739
},
{
"substitute_best_equal": {
@@ -2309,7 +2327,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"reconsidering_access_paths_for_index_ordering": {
"clause": "ORDER BY",
"fanout": 1,
- "read_time": 21.14342739,
+ "read_time": 25.34342739,
"table": "t1",
"rows_estimation": 21,
"possible_keys": [
@@ -2525,14 +2543,14 @@ select t1.a from t1 left join t2 on t1.a=t2.a {
{
"access_type": "scan",
"resulting_rows": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"uses_join_buffering": false
}
}
@@ -2543,12 +2561,13 @@ select t1.a from t1 left join t2 on t1.a=t2.a {
"plan_prefix": ["t2"],
"table": "t1",
"rows_for_plan": 4,
- "cost_for_plan": 2.806835937
+ "cost_for_plan": 3.606835937
}
]
},
{
- "best_join_order": ["t2", "t1"]
+ "best_join_order": ["t2", "t1"],
+ "cost": 3.605835937
},
{
"substitute_best_equal": {
@@ -2672,14 +2691,14 @@ explain select * from t1 left join t2 on t2.a=t1.a {
{
"access_type": "scan",
"resulting_rows": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"uses_join_buffering": false
}
}
@@ -2690,7 +2709,7 @@ explain select * from t1 left join t2 on t2.a=t1.a {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 4,
- "cost_for_plan": 2.806835937,
+ "cost_for_plan": 3.606835937,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -2703,20 +2722,22 @@ explain select * from t1 left join t2 on t2.a=t1.a {
"access_type": "eq_ref",
"index": "PRIMARY",
"rows": 1,
- "cost": 4,
+ "cond_check_cost": 1.2,
+ "startup_cost": 0,
+ "cost": 4.8,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 1.5,
- "cost": 8.417578125,
+ "cost": 10.81757812,
"chosen": false
}
],
"chosen_access_method": {
"type": "eq_ref",
"records": 1,
- "cost": 4,
+ "cost": 4.8,
"uses_join_buffering": false
}
}
@@ -2727,14 +2748,15 @@ explain select * from t1 left join t2 on t2.a=t1.a {
"plan_prefix": ["t1"],
"table": "t2",
"rows_for_plan": 4,
- "cost_for_plan": 7.606835937
+ "cost_for_plan": 9.206835937
}
]
}
]
},
{
- "best_join_order": ["t1", "t2"]
+ "best_join_order": ["t1", "t2"],
+ "cost": 9.205835937
},
{
"substitute_best_equal": {
@@ -2900,14 +2922,14 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
{
"access_type": "scan",
"resulting_rows": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"uses_join_buffering": false
}
}
@@ -2918,12 +2940,13 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
"plan_prefix": ["t3", "t2"],
"table": "t1",
"rows_for_plan": 4,
- "cost_for_plan": 2.806835937
+ "cost_for_plan": 3.606835937
}
]
},
{
- "best_join_order": ["t3", "t2", "t1"]
+ "best_join_order": ["t3", "t2", "t1"],
+ "cost": 3.605835937
},
{
"substitute_best_equal": {
@@ -3115,14 +3138,14 @@ explain extended select * from t1 where a in (select pk from t10) {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"uses_join_buffering": false
}
}
@@ -3133,7 +3156,7 @@ explain extended select * from t1 where a in (select pk from t10) {
"plan_prefix": [],
"table": "t10",
"rows_for_plan": 10,
- "cost_for_plan": 4.021972656
+ "cost_for_plan": 6.021972656
}
]
}
@@ -3152,14 +3175,14 @@ explain extended select * from t1 where a in (select pk from t10) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.006591797,
+ "cost": 2.606591797,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.006591797,
+ "cost": 2.606591797,
"uses_join_buffering": false
}
}
@@ -3171,14 +3194,14 @@ explain extended select * from t1 where a in (select pk from t10) {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"uses_join_buffering": false
}
}
@@ -3189,7 +3212,7 @@ explain extended select * from t1 where a in (select pk from t10) {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 2.606591797,
+ "cost_for_plan": 3.206591797,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -3202,14 +3225,14 @@ explain extended select * from t1 where a in (select pk from t10) {
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 10.02197266,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 10.02197266,
"uses_join_buffering": true
}
}
@@ -3220,22 +3243,22 @@ explain extended select * from t1 where a in (select pk from t10) {
"plan_prefix": ["t1"],
"table": "t10",
"rows_for_plan": 30,
- "cost_for_plan": 10.62856445,
+ "cost_for_plan": 19.22856445,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 3,
- "read_time": 10.62856445
+ "read_time": 19.22856445
},
{
"strategy": "SJ-Materialization",
"records": 3,
- "read_time": 5.278564453
+ "read_time": 7.878564453
},
{
"strategy": "DuplicateWeedout",
"records": 3,
- "read_time": 27.12856445
+ "read_time": 35.72856445
},
{
"chosen_strategy": "SJ-Materialization"
@@ -3248,7 +3271,7 @@ explain extended select * from t1 where a in (select pk from t10) {
"plan_prefix": [],
"table": "t10",
"rows_for_plan": 10,
- "cost_for_plan": 4.021972656,
+ "cost_for_plan": 6.021972656,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -3267,7 +3290,8 @@ explain extended select * from t1 where a in (select pk from t10) {
]
},
{
- "best_join_order": ["t1", "<subquery2>"]
+ "best_join_order": ["t1", "<subquery2>"],
+ "cost": 7.877564453
},
{
"substitute_best_equal": {
@@ -3602,7 +3626,9 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"index": "pk",
"used_range_estimates": true,
"rows": 1,
- "cost": 1.125585794,
+ "cond_check_cost": 1.325585794,
+ "startup_cost": 0,
+ "cost": 1.325585794,
"chosen": true
},
{
@@ -3610,7 +3636,9 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"index": "pk_a",
"used_range_estimates": true,
"rows": 1,
- "cost": 1.125829876,
+ "cond_check_cost": 1.325829876,
+ "startup_cost": 0,
+ "cost": 1.325829876,
"chosen": false,
"cause": "cost"
},
@@ -3619,7 +3647,9 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"index": "pk_a_b",
"used_range_estimates": true,
"rows": 1,
- "cost": 0.126073957,
+ "cond_check_cost": 0.326073957,
+ "startup_cost": 0,
+ "cost": 0.326073957,
"chosen": true
},
{
@@ -3631,7 +3661,7 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"chosen_access_method": {
"type": "ref",
"records": 1,
- "cost": 0.126073957,
+ "cost": 0.326073957,
"uses_join_buffering": false
}
}
@@ -3642,12 +3672,13 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 0.326073957
+ "cost_for_plan": 0.526073957
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 0.525073957
},
{
"substitute_best_equal": {
@@ -3760,14 +3791,14 @@ select f1(a) from t1 {
{
"access_type": "scan",
"resulting_rows": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"uses_join_buffering": false
}
}
@@ -3778,12 +3809,13 @@ select f1(a) from t1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 4,
- "cost_for_plan": 2.806835937
+ "cost_for_plan": 3.606835937
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.605835937
},
{
"attaching_conditions_to_tables": {
@@ -3864,14 +3896,14 @@ select f2(a) from t1 {
{
"access_type": "scan",
"resulting_rows": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 4,
- "cost": 2.006835938,
+ "cost": 2.806835937,
"uses_join_buffering": false
}
}
@@ -3882,12 +3914,13 @@ select f2(a) from t1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 4,
- "cost_for_plan": 2.806835937
+ "cost_for_plan": 3.606835937
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.605835937
},
{
"attaching_conditions_to_tables": {
@@ -3928,7 +3961,7 @@ a
2
select length(trace) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
length(trace)
-2360
+2393
set optimizer_trace_max_mem_size=100;
select * from t1;
a
@@ -3942,7 +3975,7 @@ select * from t1 {
"join_preparation": {
"select_id": 1,
"steps": [
- 2260 0
+ 2293 0
set optimizer_trace_max_mem_size=0;
select * from t1;
a
@@ -3950,7 +3983,7 @@ a
2
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-select * from t1 2360 0
+select * from t1 2393 0
drop table t1;
set optimizer_trace='enabled=off';
set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size;
@@ -4305,9 +4338,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"index": "a",
"used_range_estimates": false,
"reason": "not better than ref estimates",
- "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
- "cost": 3.001757383,
+ "cond_check_cost": 1.200585794,
+ "startup_cost": 0,
+ "cost": 3.601757383,
"chosen": true
},
{
@@ -4319,7 +4353,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"chosen_access_method": {
"type": "ref",
"records": 1,
- "cost": 3.001757383,
+ "cost": 3.601757383,
"uses_join_buffering": false
}
}
@@ -4330,7 +4364,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"plan_prefix": ["t0"],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 4.948514767
+ "cost_for_plan": 5.548514767
}
]
},
@@ -4353,9 +4387,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rec_per_key_stats_missing": true,
"used_range_estimates": false,
"reason": "not better than ref estimates",
- "rowid_filter_skipped": "worst/max seeks clipping",
"rows": 2,
- "cost": 3.003514767,
+ "cond_check_cost": 1.401171589,
+ "startup_cost": 0,
+ "cost": 4.203514767,
"chosen": true
},
{
@@ -4367,7 +4402,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"chosen_access_method": {
"type": "ref",
"records": 2,
- "cost": 3.003514767,
+ "cost": 4.203514767,
"uses_join_buffering": false
}
}
@@ -4378,17 +4413,18 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"plan_prefix": ["t1"],
"table": "t0",
"rows_for_plan": 6,
- "cost_for_plan": 5.55027215,
+ "cost_for_plan": 6.75027215,
"pruned_by_cost": true,
- "current_cost": 5.55027215,
- "best_cost": 4.948514767
+ "current_cost": 6.75027215,
+ "best_cost": 5.548514767
}
]
}
]
},
{
- "best_join_order": ["t0", "t1"]
+ "best_join_order": ["t0", "t1"],
+ "cost": 5.547514767
},
{
"substitute_best_equal": {
@@ -4514,14 +4550,14 @@ explain select * from (select rand() from t1)q {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4532,12 +4568,13 @@ explain select * from (select rand() from t1)q {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953
+ "cost_for_plan": 3.205126953
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.204126953
},
{
"attaching_conditions_to_tables": {
@@ -4586,14 +4623,14 @@ explain select * from (select rand() from t1)q {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 3,
+ "cost": 3.6,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 3,
+ "cost": 3.6,
"uses_join_buffering": false
}
}
@@ -4604,12 +4641,13 @@ explain select * from (select rand() from t1)q {
"plan_prefix": [],
"table": "<derived2>",
"rows_for_plan": 3,
- "cost_for_plan": 3.6
+ "cost_for_plan": 4.2
}
]
},
{
- "best_join_order": ["<derived2>"]
+ "best_join_order": ["<derived2>"],
+ "cost": 4.199
},
{
"attaching_conditions_to_tables": {
@@ -4800,14 +4838,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4819,14 +4857,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4837,7 +4875,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": [],
"table": "t_inner_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_1"],
@@ -4849,14 +4887,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -4867,7 +4905,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": ["t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906
+ "cost_for_plan": 9.410253906
}
]
},
@@ -4875,7 +4913,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": [],
"table": "t_inner_2",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"pruned_by_heuristic": true
}
]
@@ -4895,14 +4933,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4914,14 +4952,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4933,14 +4971,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -4951,7 +4989,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -4964,14 +5002,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -4983,14 +5021,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -5001,7 +5039,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": ["t1"],
"table": "t_inner_1",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5014,14 +5052,14 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"uses_join_buffering": true
}
}
@@ -5032,22 +5070,22 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": ["t1", "t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 27,
- "cost_for_plan": 13.81538086,
+ "cost_for_plan": 22.81538086,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 3,
- "read_time": 33.86665039
+ "read_time": 48.86665039
},
{
"strategy": "SJ-Materialization",
"records": 3,
- "read_time": 7.215380859
+ "read_time": 10.81538086
},
{
"strategy": "DuplicateWeedout",
"records": 3,
- "read_time": 18.31538086
+ "read_time": 27.31538086
},
{
"chosen_strategy": "SJ-Materialization"
@@ -5060,7 +5098,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": ["t1"],
"table": "t_inner_2",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -5070,7 +5108,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": [],
"table": "t_inner_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -5078,7 +5116,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"plan_prefix": [],
"table": "t_inner_2",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -5100,7 +5138,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
]
},
{
- "best_join_order": ["t1", "<subquery2>"]
+ "best_join_order": ["t1", "<subquery2>"],
+ "cost": 10.81438086
},
{
"substitute_best_equal": {
@@ -5382,14 +5421,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -5401,14 +5440,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -5420,14 +5459,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -5439,14 +5478,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -5458,14 +5497,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -5477,14 +5516,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -5495,7 +5534,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_outer_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5508,14 +5547,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -5527,14 +5566,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -5546,14 +5585,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -5565,14 +5604,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -5584,14 +5623,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -5602,7 +5641,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_outer_2",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5615,14 +5654,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -5634,14 +5673,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -5653,14 +5692,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -5672,14 +5711,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -5690,7 +5729,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_1",
"rows_for_plan": 81,
- "cost_for_plan": 28.22563477,
+ "cost_for_plan": 52.82563477,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5703,14 +5742,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -5722,14 +5761,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"uses_join_buffering": true
}
}
@@ -5741,14 +5780,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -5759,17 +5798,17 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 729,
- "cost_for_plan": 176.0410156,
+ "cost_for_plan": 348.2410156,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 389.4047852
+ "read_time": 721.2047852
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 289.4410156
+ "read_time": 461.6410156
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -5791,14 +5830,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -5810,14 +5849,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -5833,7 +5872,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 307.6461426,
+ "cost_for_plan": 496.6461426,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5852,14 +5891,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -5876,17 +5915,17 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 455.4615234,
+ "cost_for_plan": 792.0615234,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 668.825293
+ "read_time": 1165.025293
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 568.8615234
+ "read_time": 905.4615234
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -5904,7 +5943,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 340.0563965,
+ "cost_for_plan": 562.6563965,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -5914,7 +5953,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_4",
"rows_for_plan": 243,
- "cost_for_plan": 78.83076172,
+ "cost_for_plan": 152.6307617,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -5932,14 +5971,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -5951,14 +5990,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -5974,70 +6013,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_2",
"rows_for_plan": 2187,
- "cost_for_plan": 518.2461426,
+ "cost_for_plan": 1031.246143,
"semijoin_strategy_choice": [],
- "rest_of_plan": [
- {
- "plan_prefix": [
- "t_outer_1",
- "t_outer_2",
- "t_inner_1",
- "t_inner_4",
- "t_inner_2"
- ],
- "get_costs_for_tables": [
- {
- "best_access_path": {
- "table": "t_inner_3",
- "considered_access_paths": [
- {
- "access_type": "scan",
- "resulting_rows": 9,
- "cost": 2.015380859,
- "chosen": true
- }
- ],
- "chosen_access_method": {
- "type": "scan",
- "records": 9,
- "cost": 2.015380859,
- "uses_join_buffering": true
- }
- }
- }
- ]
- },
- {
- "plan_prefix": [
- "t_outer_1",
- "t_outer_2",
- "t_inner_1",
- "t_inner_4",
- "t_inner_2"
- ],
- "table": "t_inner_3",
- "rows_for_plan": 19683,
- "cost_for_plan": 4456.861523,
- "semijoin_strategy_choice": [
- {
- "strategy": "FirstMatch",
- "records": 27,
- "read_time": 9562.749707
- },
- {
- "strategy": "DuplicateWeedout",
- "records": 27,
- "read_time": 7413.361523
- },
- {
- "chosen_strategy": "FirstMatch"
- }
- ],
- "pruned_by_cost": true,
- "current_cost": 9562.749707,
- "best_cost": 568.8615234
- }
- ]
+ "pruned_by_cost": true,
+ "current_cost": 1031.246143,
+ "best_cost": 905.4615234
},
{
"plan_prefix": [
@@ -6048,9 +6028,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 2187,
- "cost_for_plan": 518.2461426,
+ "cost_for_plan": 1031.246143,
"semijoin_strategy_choice": [],
- "pruned_by_heuristic": true
+ "pruned_by_cost": true,
+ "current_cost": 1031.246143,
+ "best_cost": 905.4615234
}
]
},
@@ -6058,7 +6040,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 176.0410156,
+ "cost_for_plan": 348.2410156,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": "min_read_time"
}
@@ -6068,7 +6050,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_2",
"rows_for_plan": 243,
- "cost_for_plan": 60.63588867,
+ "cost_for_plan": 118.8358887,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -6076,7 +6058,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 28.22563477,
+ "cost_for_plan": 52.82563477,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -6084,7 +6066,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 60.63588867,
+ "cost_for_plan": 118.8358887,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -6094,7 +6076,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_1",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6107,14 +6089,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -6126,14 +6108,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -6145,14 +6127,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"uses_join_buffering": true
}
}
@@ -6164,14 +6146,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -6182,7 +6164,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_outer_2",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6195,14 +6177,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -6214,14 +6196,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"uses_join_buffering": true
}
}
@@ -6233,14 +6215,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -6251,12 +6233,12 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
"table": "t_inner_2",
"rows_for_plan": 729,
- "cost_for_plan": 172.4410156,
+ "cost_for_plan": 341.0410156,
"semijoin_strategy_choice": [
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 285.8410156
+ "read_time": 454.4410156
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -6278,14 +6260,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -6297,14 +6279,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -6320,7 +6302,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 304.0461426,
+ "cost_for_plan": 489.4461426,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6339,14 +6321,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -6363,17 +6345,17 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 451.8615234,
+ "cost_for_plan": 784.8615234,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 665.225293
+ "read_time": 1157.825293
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 565.2615234
+ "read_time": 898.2615234
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -6391,7 +6373,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 336.4563965,
+ "cost_for_plan": 555.4563965,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -6401,7 +6383,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
"table": "t_inner_4",
"rows_for_plan": 243,
- "cost_for_plan": 75.23076172,
+ "cost_for_plan": 145.4307617,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6419,14 +6401,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -6438,14 +6420,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -6461,65 +6443,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_2",
"rows_for_plan": 2187,
- "cost_for_plan": 514.6461426,
+ "cost_for_plan": 1024.046143,
"semijoin_strategy_choice": [],
- "rest_of_plan": [
- {
- "plan_prefix": [
- "t_outer_1",
- "t_inner_1",
- "t_outer_2",
- "t_inner_4",
- "t_inner_2"
- ],
- "get_costs_for_tables": [
- {
- "best_access_path": {
- "table": "t_inner_3",
- "considered_access_paths": [
- {
- "access_type": "scan",
- "resulting_rows": 9,
- "cost": 2.015380859,
- "chosen": true
- }
- ],
- "chosen_access_method": {
- "type": "scan",
- "records": 9,
- "cost": 2.015380859,
- "uses_join_buffering": true
- }
- }
- }
- ]
- },
- {
- "plan_prefix": [
- "t_outer_1",
- "t_inner_1",
- "t_outer_2",
- "t_inner_4",
- "t_inner_2"
- ],
- "table": "t_inner_3",
- "rows_for_plan": 19683,
- "cost_for_plan": 4453.261523,
- "semijoin_strategy_choice": [
- {
- "strategy": "DuplicateWeedout",
- "records": 27,
- "read_time": 7409.761523
- },
- {
- "chosen_strategy": "DuplicateWeedout"
- }
- ],
- "pruned_by_cost": true,
- "current_cost": 7409.761523,
- "best_cost": 565.2615234
- }
- ]
+ "pruned_by_cost": true,
+ "current_cost": 1024.046143,
+ "best_cost": 898.2615234
},
{
"plan_prefix": [
@@ -6530,9 +6458,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 2187,
- "cost_for_plan": 514.6461426,
+ "cost_for_plan": 1024.046143,
"semijoin_strategy_choice": [],
- "pruned_by_heuristic": true
+ "pruned_by_cost": true,
+ "current_cost": 1024.046143,
+ "best_cost": 898.2615234
}
]
},
@@ -6540,7 +6470,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 172.4410156,
+ "cost_for_plan": 341.0410156,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": "min_read_time"
}
@@ -6550,17 +6480,17 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 3,
- "read_time": 44.75893555
+ "read_time": 81.35893555
},
{
"strategy": "DuplicateWeedout",
"records": 3,
- "read_time": 37.22563477
+ "read_time": 58.22563477
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -6577,14 +6507,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -6596,14 +6526,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -6615,14 +6545,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -6633,7 +6563,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_outer_2",
"rows_for_plan": 27,
- "cost_for_plan": 44.64101563,
+ "cost_for_plan": 72.84101562,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6651,14 +6581,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -6670,14 +6600,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -6693,7 +6623,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 62.84614258,
+ "cost_for_plan": 107.8461426,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6712,14 +6642,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -6736,17 +6666,17 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 210.6615234,
+ "cost_for_plan": 403.2615234,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 424.025293
+ "read_time": 776.225293
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 324.0615234
+ "read_time": 516.6615234
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -6764,7 +6694,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 95.25639648,
+ "cost_for_plan": 173.8563965,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -6774,7 +6704,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_inner_4",
"rows_for_plan": 9,
- "cost_for_plan": 41.03076172,
+ "cost_for_plan": 64.43076172,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6792,14 +6722,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -6811,14 +6741,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -6834,7 +6764,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_outer_2",
"rows_for_plan": 81,
- "cost_for_plan": 59.24614258,
+ "cost_for_plan": 100.6461426,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6853,14 +6783,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -6877,12 +6807,12 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 207.0615234,
+ "cost_for_plan": 396.0615234,
"semijoin_strategy_choice": [
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 320.4615234
+ "read_time": 509.4615234
},
{
"chosen_strategy": "DuplicateWeedout"
@@ -6900,7 +6830,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 81,
- "cost_for_plan": 59.24614258,
+ "cost_for_plan": 100.6461426,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -6910,7 +6840,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_inner_3",
"rows_for_plan": 27,
- "cost_for_plan": 44.64101563,
+ "cost_for_plan": 72.84101562,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -6920,7 +6850,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_4",
"rows_for_plan": 27,
- "cost_for_plan": 13.81538086,
+ "cost_for_plan": 22.81538086,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -6933,14 +6863,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -6952,14 +6882,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -6971,14 +6901,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -6989,7 +6919,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"],
"table": "t_outer_2",
"rows_for_plan": 243,
- "cost_for_plan": 64.43076172,
+ "cost_for_plan": 123.8307617,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -7007,14 +6937,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -7026,14 +6956,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 441.2153809,
"uses_join_buffering": true
}
}
@@ -7049,11 +6979,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_2",
"rows_for_plan": 2187,
- "cost_for_plan": 503.8461426,
+ "cost_for_plan": 1002.446143,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 503.8461426,
- "best_cost": 320.4615234
+ "current_cost": 1002.446143,
+ "best_cost": 509.4615234
},
{
"plan_prefix": [
@@ -7064,11 +6994,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 2187,
- "cost_for_plan": 503.8461426,
+ "cost_for_plan": 1002.446143,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 503.8461426,
- "best_cost": 320.4615234
+ "current_cost": 1002.446143,
+ "best_cost": 509.4615234
}
]
},
@@ -7076,7 +7006,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"],
"table": "t_inner_2",
"rows_for_plan": 243,
- "cost_for_plan": 64.43076172,
+ "cost_for_plan": 123.8307617,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7084,7 +7014,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 64.43076172,
+ "cost_for_plan": 123.8307617,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -7094,7 +7024,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_3",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -7104,7 +7034,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_2",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7112,7 +7042,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_4",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7120,7 +7050,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_3",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -7130,7 +7060,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_outer_2",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7138,7 +7068,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7146,7 +7076,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_2",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7154,7 +7084,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_4",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -7162,7 +7092,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_3",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -7186,7 +7116,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"t_inner_4",
"t_outer_2",
"t_inner_3"
- ]
+ ],
+ "cost": 509.4605234
},
{
"substitute_best_equal": {
@@ -7471,14 +7402,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -7490,14 +7421,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -7508,7 +7439,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_1"],
@@ -7520,14 +7451,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -7538,7 +7469,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781
+ "cost_for_plan": 17.82050781
}
]
},
@@ -7546,7 +7477,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_2",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"pruned_by_heuristic": true
}
]
@@ -7563,14 +7494,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -7582,14 +7513,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -7600,7 +7531,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_4",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_4"],
@@ -7612,14 +7543,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -7630,7 +7561,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_inner_4"],
"table": "t_inner_3",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781
+ "cost_for_plan": 17.82050781
}
]
},
@@ -7638,7 +7569,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_3",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"pruned_by_heuristic": true
}
]
@@ -7658,14 +7589,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -7677,14 +7608,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -7696,14 +7627,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -7715,14 +7646,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -7734,14 +7665,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -7753,14 +7684,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 3.815380859,
"uses_join_buffering": false
}
}
@@ -7771,7 +7702,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_outer_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -7784,14 +7715,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -7803,14 +7734,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -7822,14 +7753,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -7841,14 +7772,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -7860,14 +7791,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -7878,7 +7809,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_outer_2",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -7891,14 +7822,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -7910,14 +7841,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -7929,14 +7860,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -7948,14 +7879,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -7966,7 +7897,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_1",
"rows_for_plan": 81,
- "cost_for_plan": 28.22563477,
+ "cost_for_plan": 52.82563477,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -7979,14 +7910,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -7998,14 +7929,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 51.20512695,
"uses_join_buffering": true
}
}
@@ -8017,14 +7948,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -8035,22 +7966,22 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 729,
- "cost_for_plan": 176.0410156,
+ "cost_for_plan": 348.2410156,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 389.4047852
+ "read_time": 721.2047852
},
{
"strategy": "SJ-Materialization",
"records": 27,
- "read_time": 16.74101562
+ "read_time": 32.34101562
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 289.4410156
+ "read_time": 461.6410156
},
{
"chosen_strategy": "SJ-Materialization"
@@ -8072,14 +8003,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -8091,14 +8022,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -8114,7 +8045,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 34.94614258,
+ "cost_for_plan": 67.34614258,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -8133,14 +8064,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 149.6153809,
"uses_join_buffering": true
}
}
@@ -8157,22 +8088,22 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 182.7615234,
+ "cost_for_plan": 362.7615234,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
- "read_time": 396.125293
+ "read_time": 735.725293
},
{
"strategy": "SJ-Materialization",
"records": 27,
- "read_time": 23.46152344
+ "read_time": 46.86152344
},
{
"strategy": "DuplicateWeedout",
"records": 27,
- "read_time": 296.1615234
+ "read_time": 476.1615234
},
{
"chosen_strategy": "SJ-Materialization"
@@ -8190,11 +8121,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 67.35639648,
+ "cost_for_plan": 133.3563965,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 67.35639648,
- "best_cost": 23.46152344
+ "current_cost": 133.3563965,
+ "best_cost": 46.86152344
}
]
},
@@ -8202,21 +8133,21 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_4",
"rows_for_plan": 243,
- "cost_for_plan": 78.83076172,
+ "cost_for_plan": 152.6307617,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 78.83076172,
- "best_cost": 23.46152344
+ "current_cost": 152.6307617,
+ "best_cost": 46.86152344
},
{
"plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],
"table": "t_inner_3",
"rows_for_plan": 729,
- "cost_for_plan": 176.0410156,
+ "cost_for_plan": 348.2410156,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 176.0410156,
- "best_cost": 23.46152344
+ "current_cost": 348.2410156,
+ "best_cost": 46.86152344
}
]
},
@@ -8224,31 +8155,31 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_2",
"rows_for_plan": 243,
- "cost_for_plan": 60.63588867,
+ "cost_for_plan": 118.8358887,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 60.63588867,
- "best_cost": 23.46152344
+ "current_cost": 118.8358887,
+ "best_cost": 46.86152344
},
{
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 28.22563477,
+ "cost_for_plan": 52.82563477,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 28.22563477,
- "best_cost": 23.46152344
+ "current_cost": 52.82563477,
+ "best_cost": 46.86152344
},
{
"plan_prefix": ["t_outer_1", "t_outer_2"],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 60.63588867,
+ "cost_for_plan": 118.8358887,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 60.63588867,
- "best_cost": 23.46152344
+ "current_cost": 118.8358887,
+ "best_cost": 46.86152344
}
]
},
@@ -8256,7 +8187,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_1",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -8269,14 +8200,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -8288,14 +8219,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -8307,14 +8238,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 8.005126953,
"uses_join_buffering": true
}
}
@@ -8326,14 +8257,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -8344,32 +8275,132 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_outer_2",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [],
- "pruned_by_cost": true,
- "current_cost": 24.62563477,
- "best_cost": 23.46152344
+ "rest_of_plan": [
+ {
+ "plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
+ "get_costs_for_tables": [
+ {
+ "best_access_path": {
+ "table": "t_inner_2",
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "resulting_rows": 9,
+ "cost": 149.6153809,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "records": 9,
+ "cost": 149.6153809,
+ "uses_join_buffering": true
+ }
+ }
+ },
+ {
+ "best_access_path": {
+ "table": "t_inner_4",
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "resulting_rows": 3,
+ "cost": 51.20512695,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "records": 3,
+ "cost": 51.20512695,
+ "uses_join_buffering": true
+ }
+ }
+ },
+ {
+ "best_access_path": {
+ "table": "t_inner_3",
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "resulting_rows": 9,
+ "cost": 149.6153809,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "records": 9,
+ "cost": 149.6153809,
+ "uses_join_buffering": true
+ }
+ }
+ }
+ ]
+ },
+ {
+ "plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
+ "table": "t_inner_2",
+ "rows_for_plan": 729,
+ "cost_for_plan": 341.0410156,
+ "semijoin_strategy_choice": [
+ {
+ "strategy": "DuplicateWeedout",
+ "records": 27,
+ "read_time": 454.4410156
+ },
+ {
+ "chosen_strategy": "DuplicateWeedout"
+ }
+ ],
+ "pruned_by_cost": true,
+ "current_cost": 454.4410156,
+ "best_cost": 46.86152344
+ },
+ {
+ "plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
+ "table": "t_inner_4",
+ "rows_for_plan": 243,
+ "cost_for_plan": 145.4307617,
+ "semijoin_strategy_choice": [],
+ "pruned_by_cost": true,
+ "current_cost": 145.4307617,
+ "best_cost": 46.86152344
+ },
+ {
+ "plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
+ "table": "t_inner_3",
+ "rows_for_plan": 729,
+ "cost_for_plan": 341.0410156,
+ "semijoin_strategy_choice": [],
+ "pruned_by_cost": true,
+ "current_cost": 341.0410156,
+ "best_cost": 46.86152344
+ }
+ ]
},
{
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_2",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 3,
- "read_time": 44.75893555
+ "read_time": 81.35893555
},
{
"strategy": "SJ-Materialization",
"records": 3,
- "read_time": 8.125634766
+ "read_time": 16.52563477
},
{
"strategy": "DuplicateWeedout",
"records": 3,
- "read_time": 37.22563477
+ "read_time": 58.22563477
},
{
"chosen_strategy": "SJ-Materialization"
@@ -8386,14 +8417,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -8405,14 +8436,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 4.405126953,
"uses_join_buffering": true
}
}
@@ -8424,14 +8455,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 9.215380859,
"uses_join_buffering": true
}
}
@@ -8442,7 +8473,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_outer_2",
"rows_for_plan": 27,
- "cost_for_plan": 15.54101562,
+ "cost_for_plan": 31.14101563,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -8460,14 +8491,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 18.80512695,
"uses_join_buffering": true
}
}
@@ -8479,14 +8510,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 52.41538086,
"uses_join_buffering": true
}
}
@@ -8502,11 +8533,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_4",
"rows_for_plan": 81,
- "cost_for_plan": 33.74614258,
+ "cost_for_plan": 66.14614258,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 33.74614258,
- "best_cost": 23.46152344
+ "current_cost": 66.14614258,
+ "best_cost": 46.86152344
},
{
"plan_prefix": [
@@ -8517,11 +8548,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 243,
- "cost_for_plan": 66.15639648,
+ "cost_for_plan": 132.1563965,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 66.15639648,
- "best_cost": 23.46152344
+ "current_cost": 132.1563965,
+ "best_cost": 46.86152344
}
]
},
@@ -8529,7 +8560,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_inner_4",
"rows_for_plan": 9,
- "cost_for_plan": 11.93076172,
+ "cost_for_plan": 22.73076172,
"semijoin_strategy_choice": [],
"rest_of_plan": [
{
@@ -8547,14 +8578,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -8566,14 +8597,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
{
"access_type": "scan",
"resulting_rows": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 9,
- "cost": 2.015380859,
+ "cost": 20.01538086,
"uses_join_buffering": true
}
}
@@ -8589,11 +8620,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_outer_2",
"rows_for_plan": 81,
- "cost_for_plan": 30.14614258,
+ "cost_for_plan": 58.94614258,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 30.14614258,
- "best_cost": 23.46152344
+ "current_cost": 58.94614258,
+ "best_cost": 46.86152344
},
{
"plan_prefix": [
@@ -8604,11 +8635,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
],
"table": "t_inner_3",
"rows_for_plan": 81,
- "cost_for_plan": 30.14614258,
+ "cost_for_plan": 58.94614258,
"semijoin_strategy_choice": [],
"pruned_by_cost": true,
- "current_cost": 30.14614258,
- "best_cost": 23.46152344
+ "current_cost": 58.94614258,
+ "best_cost": 46.86152344
}
]
},
@@ -8616,7 +8647,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
"table": "t_inner_3",
"rows_for_plan": 27,
- "cost_for_plan": 15.54101562,
+ "cost_for_plan": 31.14101563,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -8626,7 +8657,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_4",
"rows_for_plan": 27,
- "cost_for_plan": 13.81538086,
+ "cost_for_plan": 22.81538086,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8634,11 +8665,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1", "t_inner_1"],
"table": "t_inner_3",
"rows_for_plan": 81,
- "cost_for_plan": 24.62563477,
+ "cost_for_plan": 45.62563477,
"semijoin_strategy_choice": [],
- "pruned_by_cost": true,
- "current_cost": 24.62563477,
- "best_cost": 23.46152344
+ "pruned_by_heuristic": true
}
]
},
@@ -8646,7 +8675,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_2",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8654,7 +8683,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_4",
"rows_for_plan": 9,
- "cost_for_plan": 6.410253906,
+ "cost_for_plan": 9.410253906,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8662,7 +8691,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": ["t_outer_1"],
"table": "t_inner_3",
"rows_for_plan": 27,
- "cost_for_plan": 10.02050781,
+ "cost_for_plan": 17.82050781,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -8672,7 +8701,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_outer_2",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8680,7 +8709,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8688,7 +8717,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_2",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8696,7 +8725,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_4",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953,
+ "cost_for_plan": 3.205126953,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
},
@@ -8704,7 +8733,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"plan_prefix": [],
"table": "t_inner_3",
"rows_for_plan": 9,
- "cost_for_plan": 3.815380859,
+ "cost_for_plan": 5.615380859,
"semijoin_strategy_choice": [],
"pruned_by_heuristic": true
}
@@ -8742,7 +8771,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"t_outer_2",
"<subquery2>",
"<subquery3>"
- ]
+ ],
+ "cost": 46.86052344
},
{
"substitute_best_equal": {
@@ -9328,7 +9358,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 5,
- "cost": 3.017089844,
+ "cost": 4.017089844,
"chosen": true
}
],
@@ -9336,7 +9366,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 5,
- "cost": 3.017089844,
+ "cost": 4.017089844,
"uses_join_buffering": false
}
}
@@ -9350,7 +9380,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 800,
- "cost": 44.19726562,
+ "cost": 204.1972656,
"chosen": true
}
],
@@ -9358,7 +9388,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 800,
- "cost": 44.19726562,
+ "cost": 204.1972656,
"uses_join_buffering": false
}
}
@@ -9370,7 +9400,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "A",
"rows_for_plan": 5,
- "cost_for_plan": 4.017089844,
+ "cost_for_plan": 5.017089844,
"rest_of_plan":
[
{
@@ -9387,7 +9417,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 800,
- "cost": 220.9863281,
+ "cost": 1820.986328,
"chosen": true
}
],
@@ -9395,7 +9425,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 800,
- "cost": 220.9863281,
+ "cost": 1820.986328,
"uses_join_buffering": false
}
}
@@ -9407,7 +9437,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
["A"],
"table": "B",
"rows_for_plan": 4000,
- "cost_for_plan": 1025.003418
+ "cost_for_plan": 2626.003418
}
]
},
@@ -9416,7 +9446,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "B",
"rows_for_plan": 800,
- "cost_for_plan": 204.1972656,
+ "cost_for_plan": 364.1972656,
"pruned_by_heuristic": true
}
]
@@ -9445,7 +9475,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.017089844,
+ "cost": 4.017089844,
"chosen": true
}
],
@@ -9453,7 +9483,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 10,
- "cost": 2.017089844,
+ "cost": 4.017089844,
"uses_join_buffering": false
}
}
@@ -9467,7 +9497,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 800,
- "cost": 44.19726562,
+ "cost": 204.1972656,
"chosen": true
}
],
@@ -9475,7 +9505,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 800,
- "cost": 44.19726562,
+ "cost": 204.1972656,
"uses_join_buffering": false
}
}
@@ -9487,7 +9517,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "A",
"rows_for_plan": 10,
- "cost_for_plan": 4.017089844,
+ "cost_for_plan": 6.017089844,
"rest_of_plan":
[
{
@@ -9506,15 +9536,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "b",
"used_range_estimates": false,
"reason": "not available",
- "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
- "cost": 20.00585794,
+ "cond_check_cost": 2.200585794,
+ "startup_cost": 0,
+ "cost": 22.00585794,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 600,
- "cost": 84.19726562,
+ "cost": 1404.197266,
"chosen": false
}
],
@@ -9522,7 +9553,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "ref",
"records": 1,
- "cost": 20.00585794,
+ "cost": 22.00585794,
"uses_join_buffering": false
}
}
@@ -9534,7 +9565,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
["A"],
"table": "B",
"rows_for_plan": 10,
- "cost_for_plan": 26.02294779,
+ "cost_for_plan": 30.02294779,
"selectivity": 0.8,
"estimated_join_cardinality": 8
}
@@ -9545,10 +9576,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "B",
"rows_for_plan": 800,
- "cost_for_plan": 204.1972656,
+ "cost_for_plan": 364.1972656,
"pruned_by_cost": true,
- "current_cost": 204.1972656,
- "best_cost": 26.02294779
+ "current_cost": 364.1972656,
+ "best_cost": 30.02294779
}
]
]
@@ -9673,7 +9704,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"chosen": true
}
],
@@ -9681,7 +9712,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 10,
- "cost": 2.021972656,
+ "cost": 4.021972656,
"uses_join_buffering": false
}
}
@@ -9695,7 +9726,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"access_type": "scan",
"resulting_rows": 100,
- "cost": 2.219726562,
+ "cost": 22.21972656,
"chosen": true,
"use_tmp_table": true
}
@@ -9704,7 +9735,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "scan",
"records": 100,
- "cost": 2.219726562,
+ "cost": 22.21972656,
"uses_join_buffering": false
}
}
@@ -9716,7 +9747,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "t1",
"rows_for_plan": 10,
- "cost_for_plan": 4.021972656,
+ "cost_for_plan": 6.021972656,
"rest_of_plan":
[
{
@@ -9735,15 +9766,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "a",
"used_range_estimates": false,
"reason": "not available",
- "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
- "cost": 20.00585794,
+ "cond_check_cost": 2.200585794,
+ "startup_cost": 0,
+ "cost": 22.00585794,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 75,
- "cost": 7.219726562,
+ "cost": 172.2197266,
"chosen": false
}
],
@@ -9751,7 +9783,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
{
"type": "ref",
"records": 1,
- "cost": 20.00585794,
+ "cost": 22.00585794,
"uses_join_buffering": false
}
}
@@ -9763,7 +9795,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
["t1"],
"table": "t2",
"rows_for_plan": 10,
- "cost_for_plan": 26.0278306,
+ "cost_for_plan": 30.0278306,
"cost_for_sorting": 10
}
]
@@ -9773,59 +9805,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[],
"table": "t2",
"rows_for_plan": 100,
- "cost_for_plan": 22.21972656,
- "rest_of_plan":
- [
- {
- "plan_prefix":
- ["t2"],
- "get_costs_for_tables":
- [
- {
- "best_access_path":
- {
- "table": "t1",
- "considered_access_paths":
- [
- {
- "access_type": "ref",
- "index": "a",
- "used_range_estimates": false,
- "reason": "not available",
- "rowid_filter_skipped": "cost_factor <= 0",
- "rows": 1,
- "cost": 200.0585794,
- "chosen": true
- },
- {
- "access_type": "scan",
- "resulting_rows": 7.5,
- "cost": 2.521972656,
- "chosen": true
- }
- ],
- "chosen_access_method":
- {
- "type": "scan",
- "records": 7.5,
- "cost": 2.521972656,
- "uses_join_buffering": true
- }
- }
- }
- ]
- },
- {
- "plan_prefix":
- ["t2"],
- "table": "t1",
- "rows_for_plan": 750,
- "cost_for_plan": 174.7416992,
- "pruned_by_cost": true,
- "current_cost": 174.7416992,
- "best_cost": 36.0278306
- }
- ]
+ "cost_for_plan": 42.21972656,
+ "pruned_by_cost": true,
+ "current_cost": 42.21972656,
+ "best_cost": 40.0278306
}
]
]
@@ -10042,14 +10025,14 @@ select count(*) from seq_1_to_10000000 {
{
"access_type": "scan",
"resulting_rows": 10000000,
- "cost": 10000000,
+ "cost": 12000000,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 10000000,
- "cost": 10000000,
+ "cost": 12000000,
"uses_join_buffering": false
}
}
@@ -10060,12 +10043,13 @@ select count(*) from seq_1_to_10000000 {
"plan_prefix": [],
"table": "seq_1_to_10000000",
"rows_for_plan": 10000000,
- "cost_for_plan": 12000000
+ "cost_for_plan": 14000000
}
]
},
{
- "best_join_order": ["seq_1_to_10000000"]
+ "best_join_order": ["seq_1_to_10000000"],
+ "cost": 14000000
},
{
"attaching_conditions_to_tables": {
@@ -10128,8 +10112,9 @@ set @tmp=@@in_predicate_conversion_threshold;
set in_predicate_conversion_threshold=3;
explain select * from t0 where a in (1,2,3,4,5,6);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where
-1 PRIMARY <derived3> ref key0 key0 4 test.t0.a 2 FirstMatch(t0)
+1 PRIMARY t0 ALL NULL NULL NULL NULL 10
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 6
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
@@ -10231,8 +10216,6 @@ S
{
"access_type": "ref",
"index": "PRIMARY",
- "rows": 1.79769e308,
- "cost": 1.79769e308,
"chosen": false,
"cause": "no predicate for first keypart"
}
@@ -10423,7 +10406,9 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"used_range_estimates": false,
"reason": "not available",
"rows": 1.8367,
- "cost": 2.000585794,
+ "cond_check_cost": 2.367925794,
+ "startup_cost": 0,
+ "cost": 2.367925794,
"chosen": true
},
{
@@ -10436,7 +10421,7 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
{
"type": "ref",
"records": 1.8367,
- "cost": 2.000585794,
+ "cost": 2.367925794,
"uses_join_buffering": false
}
}
@@ -10448,7 +10433,7 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
[],
"table": "t2",
"rows_for_plan": 1.8367,
- "cost_for_plan": 2.367925794,
+ "cost_for_plan": 2.735265794,
"cost_for_sorting": 1.8367
}
]
@@ -10459,8 +10444,8 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"table": "t2",
"key": "idx_a",
"record_count": 4,
- "cost": 2.488945919,
- "unsplit_cost": 25.72361682
+ "cost": 2.856285919,
+ "unsplit_cost": 43.72361682
}
}
]
@@ -10472,8 +10457,8 @@ information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.lateral_derived'))
[
{
- "startup_cost": 9.955783677,
- "splitting_cost": 2.488945919,
+ "startup_cost": 11.42514368,
+ "splitting_cost": 2.856285919,
"records": 1
}
]
diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result
index dd23093ad9e..5944bfc8c3f 100644
--- a/mysql-test/main/opt_trace_index_merge.result
+++ b/mysql-test/main/opt_trace_index_merge.result
@@ -238,7 +238,8 @@ explain select * from t1 where a=1 or b=1 {
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 2.883903732
},
{
"substitute_best_equal": {
diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result
index adb9cd5d622..0ce74504b13 100644
--- a/mysql-test/main/opt_trace_index_merge_innodb.result
+++ b/mysql-test/main/opt_trace_index_merge_innodb.result
@@ -212,7 +212,9 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"index": "key1",
"used_range_estimates": true,
"rows": 1,
- "cost": 1.125146475,
+ "cond_check_cost": 1.325146475,
+ "startup_cost": 0,
+ "cost": 1.325146475,
"chosen": true
},
{
@@ -224,7 +226,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"chosen_access_method": {
"type": "ref",
"records": 1,
- "cost": 1.125146475,
+ "cost": 1.325146475,
"uses_join_buffering": false
}
}
@@ -235,12 +237,13 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 1,
- "cost_for_plan": 1.325146475
+ "cost_for_plan": 1.525146475
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 1.524146475
},
{
"substitute_best_equal": {
diff --git a/mysql-test/main/opt_trace_security.result b/mysql-test/main/opt_trace_security.result
index 48ca5c5e36f..ed828cda438 100644
--- a/mysql-test/main/opt_trace_security.result
+++ b/mysql-test/main/opt_trace_security.result
@@ -97,14 +97,14 @@ select * from db1.t1 {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -115,12 +115,13 @@ select * from db1.t1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953
+ "cost_for_plan": 3.205126953
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.204126953
},
{
"attaching_conditions_to_tables": {
@@ -226,14 +227,14 @@ select * from db1.v1 {
{
"access_type": "scan",
"resulting_rows": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"chosen": true
}
],
"chosen_access_method": {
"type": "scan",
"records": 3,
- "cost": 2.005126953,
+ "cost": 2.605126953,
"uses_join_buffering": false
}
}
@@ -244,12 +245,13 @@ select * from db1.v1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 3,
- "cost_for_plan": 2.605126953
+ "cost_for_plan": 3.205126953
}
]
},
{
- "best_join_order": ["t1"]
+ "best_join_order": ["t1"],
+ "cost": 3.204126953
},
{
"attaching_conditions_to_tables": {
diff --git a/mysql-test/main/opt_trace_selectivity.result b/mysql-test/main/opt_trace_selectivity.result
index 31eddaf5c10..86290a631fd 100644
--- a/mysql-test/main/opt_trace_selectivity.result
+++ b/mysql-test/main/opt_trace_selectivity.result
@@ -49,7 +49,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "a",
"used_range_estimates": true,
"rows": 104,
- "cost": 104.16562,
+ "cond_check_cost": 124.96562,
+ "startup_cost": 0,
+ "cost": 124.96562,
"chosen": true
},
{
@@ -57,7 +59,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "b",
"used_range_estimates": true,
"rows": 340,
- "cost": 340.2577963,
+ "cond_check_cost": 408.2577963,
+ "startup_cost": 0,
+ "cost": 408.2577963,
"chosen": false,
"cause": "cost"
},
@@ -66,7 +70,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "c",
"used_range_estimates": true,
"rows": 632,
- "cost": 632.3718449,
+ "cond_check_cost": 758.7718449,
+ "startup_cost": 0,
+ "cost": 758.7718449,
"chosen": false,
"cause": "cost"
},
@@ -137,7 +143,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "a",
"used_range_estimates": true,
"rows": 6,
- "cost": 6.127343464,
+ "cond_check_cost": 7.327343464,
+ "startup_cost": 0,
+ "cost": 7.327343464,
"chosen": true
},
{
@@ -145,7 +153,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "b",
"used_range_estimates": true,
"rows": 232,
- "cost": 232.2156139,
+ "cond_check_cost": 278.6156139,
+ "startup_cost": 0,
+ "cost": 278.6156139,
"chosen": false,
"cause": "cost"
},
@@ -154,7 +164,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "c",
"used_range_estimates": true,
"rows": 293,
- "cost": 293.2394392,
+ "cond_check_cost": 351.8394392,
+ "startup_cost": 0,
+ "cost": 351.8394392,
"chosen": false,
"cause": "cost"
},
diff --git a/mysql-test/main/opt_tvc.result b/mysql-test/main/opt_tvc.result
index eaf75ed7999..504038954b2 100644
--- a/mysql-test/main/opt_tvc.result
+++ b/mysql-test/main/opt_tvc.result
@@ -150,11 +150,11 @@ from t2 where b in (3,4)
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 MATERIALIZED <derived4> ref key0 key0 4 test.t2.b 2 100.00
4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`_col_1`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `tvc_0`.`_col_1` = `test`.`t2`.`b`
explain extended select * from t1
where a in
(
@@ -168,11 +168,11 @@ from (values (3),(4)) as tvc_0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 MATERIALIZED <derived4> ref key0 key0 4 test.t2.b 2 100.00
4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`3`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `tvc_0`.`3` = `test`.`t2`.`b`
# derived table with IN-predicate
select * from
(
@@ -382,11 +382,11 @@ as dr_table
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 MATERIALIZED <derived5> ref key0 key0 4 test.t1.a 2 100.00
5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`_col_1`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `tvc_0`.`_col_1` = `test`.`t1`.`a`
explain extended select * from t1
where a in
(
@@ -407,11 +407,11 @@ as dr_table
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 MATERIALIZED <derived5> ref key0 key0 4 test.t1.a 2 100.00
5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`1`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `tvc_0`.`1` = `test`.`t1`.`a`
# derived table with IN-predicate and group by
select * from
(
@@ -568,18 +568,18 @@ explain extended select * from t1
where (a,b) not in ((1,2),(8,9), (5,1));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
-2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key
+2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 3 100.00
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`_col_2`)))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( <materialize> (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`_col_1` and `test`.`t1`.`b` = `<subquery2>`.`_col_2`))))
explain extended select * from t1
where (a,b) not in (select * from (values (1,2),(8,9), (5,1)) as tvc_0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
-2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key
+2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 3 100.00
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`2`)))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( <materialize> (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`1` and `test`.`t1`.`b` = `<subquery2>`.`2`))))
select * from t1
where b < 7 and (a,b) not in ((1,2),(8,9), (5,1));
a b
@@ -590,10 +590,10 @@ explain extended select * from t1
where b < 7 and (a,b) not in ((1,2),(8,9), (5,1));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
-2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key
+2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 3 100.00
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` < 7 and !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`_col_2`)))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` < 7 and !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( <materialize> (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`_col_1` and `test`.`t1`.`b` = `<subquery2>`.`_col_2`))))
select * from t2
where (a,c) not in ((1,2),(8,9), (5,1));
a b c
@@ -606,10 +606,10 @@ explain extended select * from t2
where (a,c) not in ((1,2),(8,9), (5,1));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
-2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key
+2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 3 100.00
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t2`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t2`.`c`) = `tvc_0`.`_col_2`)))))
+Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( <materialize> (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`_col_1` and `test`.`t2`.`c` = `<subquery2>`.`_col_2`))))
drop table t1, t2, t3;
set @@in_predicate_conversion_threshold= default;
#
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index 1311f42dac2..c1016393828 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3188,13 +3188,13 @@ explain
select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
from t2, t3 where t2.a=t3.a order by t2.a limit 25;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL a NULL NULL NULL 200 Using where; Using filesort
+1 SIMPLE t2 index a a 5 NULL 25 Using where
1 SIMPLE t3 ref a a 5 test.t2.a 1
explain
select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
from t2, t3 where t2.a=t3.a order by t3.a limit 25;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL a NULL NULL NULL 200 Using where; Using filesort
+1 SIMPLE t2 index a a 5 NULL 25 Using where
1 SIMPLE t3 ref a a 5 test.t2.a 1
select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
from t2, t3 where t2.a=t3.a order by t2.a limit 25;
diff --git a/mysql-test/main/partition_pruning.result b/mysql-test/main/partition_pruning.result
index ec0cb144a51..519bf590b9b 100644
--- a/mysql-test/main/partition_pruning.result
+++ b/mysql-test/main/partition_pruning.result
@@ -2677,7 +2677,7 @@ select * from t1 X, t1 Y
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE X p1,p2 range a,b a 4 NULL 4 Using where
-1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
+1 SIMPLE Y p2,p3 ref|filter a,b b|a 4|4 test.X.b 2 (50%) Using where; Using rowid filter
explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result
index e86cff59bd3..3f27ef6540f 100644
--- a/mysql-test/main/rowid_filter.result
+++ b/mysql-test/main/rowid_filter.result
@@ -360,7 +360,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition
-1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
+1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
@@ -397,6 +397,14 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 69,
+ "selectivity_pct": 4.6
+ },
"rows": 1,
"filtered": 4.599999905,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
@@ -411,7 +419,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition
-1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.60 11.22 Using where
+1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
@@ -458,13 +466,26 @@ ANALYZE
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 69,
+ "selectivity_pct": 4.6,
+ "r_rows": 71,
+ "r_lookups": 96,
+ "r_selectivity_pct": 10.41666667,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
"r_loops": 98,
"rows": 1,
- "r_rows": 1,
+ "r_rows": 0.112244898,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 4.599999905,
- "r_filtered": 11.2244898,
+ "r_filtered": 100,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
}
@@ -627,7 +648,7 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter
-1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
+1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) Using where; Using rowid filter
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -675,6 +696,14 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 139,
+ "selectivity_pct": 9.266666667
+ },
"rows": 1,
"filtered": 9.266666412,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
@@ -690,7 +719,7 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter
-1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.27 26.67 Using where
+1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) 0.27 (25%) 9.27 100.00 Using where; Using rowid filter
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -753,13 +782,26 @@ ANALYZE
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 139,
+ "selectivity_pct": 9.266666667,
+ "r_rows": 144,
+ "r_lookups": 59,
+ "r_selectivity_pct": 25.42372881,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
"r_loops": 60,
"rows": 1,
- "r_rows": 1,
+ "r_rows": 0.266666667,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 9.266666412,
- "r_filtered": 26.66666667,
+ "r_filtered": 100,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
}
@@ -941,7 +983,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition
-1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) Using where; Using rowid filter
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -978,14 +1020,6 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_l_shipdate",
- "used_key_parts": ["l_shipDATE"]
- },
- "rows": 509,
- "selectivity_pct": 8.476269775
- },
"rows": 4,
"filtered": 8.476269722,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
@@ -1000,7 +1034,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition
-1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) 0.52 (7%) 8.48 100.00 Using where; Using rowid filter
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.70 8.48 7.77 Using where
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -1047,26 +1081,13 @@ ANALYZE
"key_length": "4",
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_l_shipdate",
- "used_key_parts": ["l_shipDATE"]
- },
- "rows": 509,
- "selectivity_pct": 8.476269775,
- "r_rows": 510,
- "r_lookups": 476,
- "r_selectivity_pct": 7.773109244,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
"r_loops": 71,
"rows": 4,
- "r_rows": 0.521126761,
+ "r_rows": 6.704225352,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.476269722,
- "r_filtered": 100,
+ "r_filtered": 7.773109244,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
}
@@ -2257,8 +2278,8 @@ pk1 a1 b1 pk2 a2 b2
EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 )
WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00
-1 PRIMARY t1 ALL a1,b1 NULL NULL NULL 400 21.56 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where
+1 PRIMARY t1 ref|filter a1,b1 a1|b1 5|4 test.t2.a2 36 (29%) 28.75 Using where; Using rowid filter
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2
@@ -2274,23 +2295,30 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 101,
- "filtered": 100
+ "filtered": 100,
+ "attached_condition": "t2.a2 is not null"
}
},
{
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "possible_keys": ["a1", "b1"],
- "rows": 400,
- "filtered": 21.5625,
- "attached_condition": "t1.b1 <= (subquery#2)"
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a1", "b1"],
+ "key": "a1",
+ "key_length": "5",
+ "used_key_parts": ["a1"],
+ "ref": ["test.t2.a2"],
+ "rowid_filter": {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1"]
+ },
+ "rows": 115,
+ "selectivity_pct": 28.75
},
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL",
- "attached_condition": "t1.a1 = t2.a2 and t1.pk1 + 1 = t2.pk2 + 2"
+ "rows": 36,
+ "filtered": 28.75,
+ "attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2"
}
}
],
@@ -2740,33 +2768,20 @@ ANALYZE
{
"table": {
"table_name": "t1",
- "access_type": "ref",
+ "access_type": "range",
"possible_keys": ["idx1", "idx2"],
- "key": "idx2",
- "key_length": "5",
- "used_key_parts": ["fl2"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
- "key": "idx1",
- "used_key_parts": ["nm"]
- },
- "rows": 44,
- "selectivity_pct": 0.44,
- "r_rows": 44,
- "r_lookups": 1000,
- "r_selectivity_pct": 0,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
+ "key": "idx1",
+ "key_length": "256",
+ "used_key_parts": ["nm"],
"r_loops": 1,
- "rows": 863,
- "r_rows": 0,
+ "rows": 44,
+ "r_rows": 44,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
- "filtered": 0.439999998,
- "r_filtered": 100,
- "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'"
+ "filtered": 8.630000114,
+ "r_filtered": 0,
+ "index_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'",
+ "attached_condition": "t1.fl2 = 0"
}
}
]
@@ -2806,31 +2821,20 @@ ANALYZE
{
"table": {
"table_name": "t1",
- "access_type": "ref",
+ "access_type": "range",
"possible_keys": ["idx1", "idx2"],
- "key": "idx2",
- "key_length": "5",
- "used_key_parts": ["fl2"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
- "key": "idx1",
- "used_key_parts": ["nm"]
- },
- "rows": 44,
- "selectivity_pct": 0.44,
- "r_rows": 0,
- "r_lookups": 0,
- "r_selectivity_pct": 0,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
+ "key": "idx1",
+ "key_length": "256",
+ "used_key_parts": ["nm"],
"r_loops": 1,
- "rows": 853,
+ "rows": 44,
"r_rows": 0,
- "filtered": 0.439999998,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.529999733,
"r_filtered": 100,
- "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'"
+ "index_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'",
+ "attached_condition": "t1.fl2 = 0"
}
}
]
diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result
index 51c061fe3a4..c8220e0f5a1 100644
--- a/mysql-test/main/rowid_filter_innodb.result
+++ b/mysql-test/main/rowid_filter_innodb.result
@@ -2730,33 +2730,20 @@ ANALYZE
{
"table": {
"table_name": "t1",
- "access_type": "ref",
+ "access_type": "range",
"possible_keys": ["idx1", "idx2"],
- "key": "idx2",
- "key_length": "5",
- "used_key_parts": ["fl2"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
- "key": "idx1",
- "used_key_parts": ["nm"]
- },
- "rows": 44,
- "selectivity_pct": 0.44,
- "r_rows": 44,
- "r_lookups": 1000,
- "r_selectivity_pct": 0,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
+ "key": "idx1",
+ "key_length": "256",
+ "used_key_parts": ["nm"],
"r_loops": 1,
- "rows": 863,
- "r_rows": 0,
+ "rows": 44,
+ "r_rows": 44,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
- "filtered": 0.439999998,
- "r_filtered": 100,
- "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'"
+ "filtered": 8.630000114,
+ "r_filtered": 0,
+ "index_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'",
+ "attached_condition": "t1.fl2 = 0"
}
}
]
@@ -2796,31 +2783,20 @@ ANALYZE
{
"table": {
"table_name": "t1",
- "access_type": "ref",
+ "access_type": "range",
"possible_keys": ["idx1", "idx2"],
- "key": "idx2",
- "key_length": "5",
- "used_key_parts": ["fl2"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
- "key": "idx1",
- "used_key_parts": ["nm"]
- },
- "rows": 44,
- "selectivity_pct": 0.44,
- "r_rows": 0,
- "r_lookups": 0,
- "r_selectivity_pct": 0,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
+ "key": "idx1",
+ "key_length": "256",
+ "used_key_parts": ["nm"],
"r_loops": 1,
- "rows": 853,
+ "rows": 44,
"r_rows": 0,
- "filtered": 0.439999998,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.529999733,
"r_filtered": 100,
- "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'"
+ "index_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'",
+ "attached_condition": "t1.fl2 = 0"
}
}
]
diff --git a/mysql-test/main/rowid_filter_innodb_debug.test b/mysql-test/main/rowid_filter_innodb_debug.test
index 60381658eaf..99d32f9616d 100644
--- a/mysql-test/main/rowid_filter_innodb_debug.test
+++ b/mysql-test/main/rowid_filter_innodb_debug.test
@@ -1,7 +1,9 @@
--source include/have_innodb.inc
+--source include/have_sequence.inc
--source include/no_valgrind_without_big.inc
set default_storage_engine=innodb;
--source include/rowid_filter_debug_kill.inc
set default_storage_engine=default;
+
diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result
index bedc8bfa4b8..2b545fe5e94 100644
--- a/mysql-test/main/select.result
+++ b/mysql-test/main/select.result
@@ -3480,7 +3480,7 @@ EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where
-1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ref c c 5 test.t1.a 2
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
@@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3717,7 +3717,7 @@ COUNT(*)
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
@@ -3731,7 +3731,7 @@ CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result
index 520eb5afa33..7541fdf9e56 100644
--- a/mysql-test/main/select_jcl6.result
+++ b/mysql-test/main/select_jcl6.result
@@ -3491,7 +3491,7 @@ EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ref c c 5 test.t1.a 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
@@ -3627,7 +3627,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3635,7 +3635,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3728,7 +3728,7 @@ COUNT(*)
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
@@ -3742,7 +3742,7 @@ CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result
index bedc8bfa4b8..2b545fe5e94 100644
--- a/mysql-test/main/select_pkeycache.result
+++ b/mysql-test/main/select_pkeycache.result
@@ -3480,7 +3480,7 @@ EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where
-1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ref c c 5 test.t1.a 2
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
@@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
+1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3717,7 +3717,7 @@ COUNT(*)
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
@@ -3731,7 +3731,7 @@ CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter
+1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result
index e14bad43be9..1dff67e804a 100644
--- a/mysql-test/main/selectivity.result
+++ b/mysql-test/main/selectivity.result
@@ -114,17 +114,17 @@ order by
s_acctbal desc, n_name, s_name, p_partkey;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort
+1 PRIMARY nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 100.00
+1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00
1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 2.08 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where
-1 PRIMARY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where
-1 PRIMARY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
+1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where
2 DEPENDENT SUBQUERY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where
2 DEPENDENT SUBQUERY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00
2 DEPENDENT SUBQUERY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where
2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((/* select#2 */ select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
+Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((/* select#2 */ select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
=== Q15 ===
create view revenue0 (supplier_no, total_revenue) as
select l_suppkey, sum(l_extendedprice * (1 - l_discount))
@@ -1661,7 +1661,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
# gives selectivity data
explain extended select * from t1 where a in (17,51,5) and b=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
+1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
drop table t1;
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index 2371cfa111c..cdde80cf248 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -77,8 +77,8 @@ and r_name = 'ASIA'
order by
s_acctbal desc, n_name, s_name, p_partkey;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort
-1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 0.50 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 0.50 Using where; Using temporary; Using filesort
+1 PRIMARY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
1 PRIMARY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where
1 PRIMARY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
@@ -1673,7 +1673,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
# gives selectivity data
explain extended select * from t1 where a in (17,51,5) and b=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
+1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
drop table t1;
diff --git a/mysql-test/main/single_delete_update.result b/mysql-test/main/single_delete_update.result
index 85e79f53c89..1f0299ac0fc 100644
--- a/mysql-test/main/single_delete_update.result
+++ b/mysql-test/main/single_delete_update.result
@@ -129,21 +129,21 @@ a b c d
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_priority_queue_sorts 1
+Sort_priority_queue_sorts 0
Sort_range 0
-Sort_rows 1
-Sort_scan 1
+Sort_rows 0
+Sort_scan 0
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
-Handler_read_first 0
+Handler_read_first 1
Handler_read_key 0
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 16
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
-Handler_read_rnd_next 17
+Handler_read_rnd_next 0
FLUSH STATUS;
DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
SHOW SESSION STATUS LIKE 'Sort%';
@@ -734,21 +734,21 @@ a b c d
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_priority_queue_sorts 1
+Sort_priority_queue_sorts 0
Sort_range 0
-Sort_rows 1
-Sort_scan 1
+Sort_rows 0
+Sort_scan 0
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
-Handler_read_first 0
+Handler_read_first 1
Handler_read_key 0
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 16
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
-Handler_read_rnd_next 17
+Handler_read_rnd_next 0
FLUSH STATUS;
UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
SHOW SESSION STATUS LIKE 'Sort%';
diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result
index dd6251edcd5..a753aaa2e5d 100644
--- a/mysql-test/main/stat_tables.result
+++ b/mysql-test/main/stat_tables.result
@@ -71,10 +71,10 @@ order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6
1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
where c_custkey = o_custkey and l_orderkey = o_orderkey
@@ -85,7 +85,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
delete from mysql.index_stats;
@@ -178,10 +178,10 @@ order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6
1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
where c_custkey = o_custkey and l_orderkey = o_orderkey
@@ -192,7 +192,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
EXPLAIN select o_year,
diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result
index d17bd9c6a61..18e792ef02e 100644
--- a/mysql-test/main/status.result
+++ b/mysql-test/main/status.result
@@ -71,10 +71,10 @@ a
6
show status like 'last_query_cost';
Variable_name Value
-Last_query_cost 12.084449
+Last_query_cost 22.084449
show status like 'last_query_cost';
Variable_name Value
-Last_query_cost 12.084449
+Last_query_cost 22.084449
select 1;
1
1
@@ -134,13 +134,13 @@ a
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 2.402418
+Last_query_cost 2.802418
EXPLAIN SELECT a FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 2.402418
+Last_query_cost 2.802418
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
a
1
@@ -173,7 +173,7 @@ a a
1 1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
-Last_query_cost 5.205836
+Last_query_cost 6.805836
DROP TABLE t1;
connect con1,localhost,root,,;
show status like 'com_show_status';
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 668ccdf773f..79c6cd78e92 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -1440,7 +1440,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1450,7 +1450,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1459,11 +1459,11 @@ a
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 100.00
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 75.00 Using where; Using index; Using join buffer (flat, BNL join)
-1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t2`.`a` = `test`.`t1`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -4541,15 +4541,15 @@ SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
@@ -7040,8 +7040,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect2.result b/mysql-test/main/subselect2.result
index ebeda9a64af..db6c85900ad 100644
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3_b eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3_a.PARENTID 1 Using where
1 PRIMARY t3_c eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3_b.PARENTID 1 Using where
1 PRIMARY t3_d eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3_c.PARENTID 1 Using where
-1 PRIMARY t3_e eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3_d.PARENTID 1 Using where
+1 PRIMARY t3_e ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3_d.PARENTID 1 (29%) Using where; Using rowid filter
drop table t1, t2, t3, t4;
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
INSERT INTO t1 VALUES (1),(2);
diff --git a/mysql-test/main/subselect3.result b/mysql-test/main/subselect3.result
index 2820775cb4f..28187e0ffdd 100644
--- a/mysql-test/main/subselect3.result
+++ b/mysql-test/main/subselect3.result
@@ -166,7 +166,7 @@ from t3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key
-2 DEPENDENT SUBQUERY t2 ALL a NULL NULL NULL 10 75.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3`
diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result
index 8be02ad5c2a..9df821e07dc 100644
--- a/mysql-test/main/subselect3_jcl6.result
+++ b/mysql-test/main/subselect3_jcl6.result
@@ -169,7 +169,7 @@ from t3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key
-2 DEPENDENT SUBQUERY t2 ALL a NULL NULL NULL 10 75.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3`
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 5589272d066..6f29fe34ca5 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -1279,8 +1279,8 @@ EXPLAIN
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
@@ -1288,8 +1288,8 @@ c1 c1 c1
EXPLAIN
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t4 index NULL PRIMARY 3 NULL 2 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-1 PRIMARY t4 index NULL PRIMARY 3 NULL 2 Using index; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
@@ -1370,8 +1370,8 @@ GROUP BY SQ1_t1.f4));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 SUBQUERY SQ1_t3 range f4 f4 5 NULL 2 Using where; Using index; Using temporary
-3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join)
+3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using temporary
+3 SUBQUERY SQ1_t3 range f4 f4 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 WHERE
(SELECT f2 FROM t2
WHERE f4 <= ALL
diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result
index d03edf522eb..a473f48e0f6 100644
--- a/mysql-test/main/subselect_exists2in.result
+++ b/mysql-test/main/subselect_exists2in.result
@@ -902,8 +902,8 @@ WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where
3 DEPENDENT SUBQUERY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00
-3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
4 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1
@@ -922,8 +922,8 @@ WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where
3 DEPENDENT SUBQUERY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00
-3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
4 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1
diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result
index 242b01f8955..0c44708eb32 100644
--- a/mysql-test/main/subselect_innodb.result
+++ b/mysql-test/main/subselect_innodb.result
@@ -612,9 +612,9 @@ INNER JOIN
ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
ON ( f1 >= f2 );
id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
3 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result
index 4f5739aa4a7..2353e18c28e 100644
--- a/mysql-test/main/subselect_mat.result
+++ b/mysql-test/main/subselect_mat.result
@@ -1889,8 +1889,8 @@ WHERE alias4.c = alias3.b
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 MATERIALIZED alias3 ALL NULL NULL NULL NULL 2
-3 MATERIALIZED alias4 index c c 11 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+3 MATERIALIZED alias3 ALL NULL NULL NULL NULL 2 Using where
+3 MATERIALIZED alias4 ref c c 11 test.alias3.b 2 Using where; Using index
DROP TABLE t1,t2;
#
# BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result
@@ -2241,8 +2241,8 @@ WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
-2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
@@ -2275,8 +2275,8 @@ WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 index i2 i2 5 NULL 3 100.00 Using where; Using index
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 DEPENDENT SUBQUERY t2 range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
@@ -2314,8 +2314,8 @@ SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
@@ -2462,8 +2462,8 @@ alter table t1 add key(id);
explain
SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index id id 4 NULL 9 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
1
@@ -2519,8 +2519,8 @@ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2;
explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index id id 4 NULL 9 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
1
diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result
index 67a4feafeee..185a99672e6 100644
--- a/mysql-test/main/subselect_mat_cost_bugs.result
+++ b/mysql-test/main/subselect_mat_cost_bugs.result
@@ -196,8 +196,8 @@ ORDER BY field1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using filesort
1 PRIMARY alias1 eq_ref PRIMARY PRIMARY 4 alias2.f3 1 Using index
-3 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
+3 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
2 DERIVED t2 ALL NULL NULL NULL NULL 2
SELECT alias2.f2 AS field1
FROM t1 AS alias1 JOIN ( SELECT * FROM t2 ) AS alias2 ON alias2.f3 = alias1.f1
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 4a8a9ffc322..18cc982c565 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -1444,7 +1444,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1454,7 +1454,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1463,11 +1463,11 @@ a
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 100.00
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 75.00 Using where; Using index; Using join buffer (flat, BNL join)
-1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t2`.`a` = `test`.`t1`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -4543,15 +4543,15 @@ SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
@@ -7040,8 +7040,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index 42b767c505e..0aa5f00a149 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -1447,7 +1447,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1457,7 +1457,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1466,11 +1466,11 @@ a
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 100.00
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 75.00 Using where; Using index; Using join buffer (flat, BNL join)
-1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t2`.`a` = `test`.`t1`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 51386376d80..e11c344cfb4 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -7031,8 +7031,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 3b4f0aa368f..8208e7a5379 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -1446,7 +1446,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1456,7 +1456,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1465,11 +1465,11 @@ a
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 100.00
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 75.00 Using where; Using index; Using join buffer (flat, BNL join)
-1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t2`.`a` = `test`.`t1`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -4547,15 +4547,15 @@ SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
@@ -7046,8 +7046,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index a66886cfc21..e14d3d8bb73 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -7031,8 +7031,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result
index 1da51e76b4d..8078700bf5b 100644
--- a/mysql-test/main/subselect_sj.result
+++ b/mysql-test/main/subselect_sj.result
@@ -160,26 +160,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY s47 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 PRIMARY s48 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 PRIMARY s49 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m00 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m02 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m03 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m04 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m05 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m06 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m07 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m08 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m09 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m10 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m11 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m12 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m13 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m14 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m15 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m00 ALL NULL NULL NULL NULL 3
+2 MATERIALIZED m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m02 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m03 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m04 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m05 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m06 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m07 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m08 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m09 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m10 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m11 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m12 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m13 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m14 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m15 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m19 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
select * from
t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
where t1.a < 5;
@@ -344,8 +344,8 @@ WHERE PNUM IN
(SELECT PNUM FROM PROJ));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY STAFF ALL NULL NULL NULL NULL 5
-1 PRIMARY PROJ ALL NULL NULL NULL NULL 6
-1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF)
+1 PRIMARY PROJ ALL NULL NULL NULL NULL 6 Start temporary
+1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; End temporary
SELECT EMPNUM, EMPNAME
FROM STAFF
WHERE EMPNUM IN
@@ -763,16 +763,16 @@ explain extended
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00
-1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where; FirstMatch(t1)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Start temporary
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where; End temporary; Using join buffer (flat, BNL join)
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
show warnings;
Level Code Message
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
@@ -1610,9 +1610,9 @@ A.t1field IN (SELECT C.t2field FROM t2 C
WHERE C.t2field IN (SELECT D.t2field FROM t2 D));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A index PRIMARY PRIMARY 4 NULL 3 Using index
-1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; Start temporary; End temporary
-1 PRIMARY C index PRIMARY PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY C eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index
1 PRIMARY D eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index
+1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; Start temporary; End temporary
SELECT * FROM t1 A
WHERE
A.t1field IN (SELECT A.t1field FROM t2 B) AND
@@ -2178,10 +2178,10 @@ INSERT INTO t5 VALUES (7,0),(9,0);
explain
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan
+1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; Start temporary
1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where
-1 PRIMARY t4 ALL NULL NULL NULL NULL 3 FirstMatch(t5)
-1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3
+1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (flat, BNL join)
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
a
0
diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result
index 6643aa13f83..52925aa030a 100644
--- a/mysql-test/main/subselect_sj2.result
+++ b/mysql-test/main/subselect_sj2.result
@@ -131,9 +131,8 @@ set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
explain select * from t1 where a in (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t2 index b b 5 NULL 20 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t2 ref b b 5 test.t1.a 1 Using index; FirstMatch(t1)
select * from t1;
a b
1 1
@@ -840,9 +839,9 @@ SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
-1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
-1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
-1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
+1 PRIMARY alias2 index f12 f12 7 NULL # Using index; Start temporary
+1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index
+1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; End temporary; Using join buffer (flat, BNL join)
SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
f12
diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result
index 83abb68ca51..0539ab03a84 100644
--- a/mysql-test/main/subselect_sj2_jcl6.result
+++ b/mysql-test/main/subselect_sj2_jcl6.result
@@ -142,9 +142,8 @@ set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
explain select * from t1 where a in (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t2 index b b 5 NULL 20 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t2 ref b b 5 test.t1.a 1 Using index; FirstMatch(t1)
select * from t1;
a b
1 1
@@ -853,9 +852,9 @@ SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
-1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
-1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
-1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
+1 PRIMARY alias2 index f12 f12 7 NULL # Using index; Start temporary
+1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t3 hash_ALL NULL #hash#$hj 3 test.alias2.f12 # Using where; End temporary; Using join buffer (incremental, BNLH join)
SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
f12
@@ -924,9 +923,9 @@ SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
WHERE t3.b IN (SELECT b FROM t4);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 1
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY t2 hash_ALL NULL #hash#$hj 4 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2
3 DERIVED t1 ALL NULL NULL NULL NULL 1
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
@@ -1238,9 +1237,9 @@ explain
SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index
-1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary; Using join buffer (flat, BNL join)
-1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
-1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; Using index; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; Start temporary; Using join buffer (flat, BNL join)
+1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t2.t2_c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
+1 PRIMARY t3 hash_ALL NULL #hash#$hj 38 test.t2.t2_c 2 Using where; End temporary; Using join buffer (incremental, BNLH join)
DROP TABLE t1,t2,t3,t4;
#
# MDEV-6263: Wrong result when using IN subquery with order by
diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result
index 5d7e7d49da2..024cfb53960 100644
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@ -133,9 +133,8 @@ set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
explain select * from t1 where a in (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t2 index b b 5 NULL 20 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t2 ref b b 5 test.t1.a 1 Using index; FirstMatch(t1)
select * from t1;
a b
1 1
@@ -842,9 +841,9 @@ SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
-1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
-1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
-1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
+1 PRIMARY alias2 index f12 f12 7 NULL # Using index; Start temporary
+1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index
+1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; End temporary; Using join buffer (flat, BNL join)
SELECT * FROM t3
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
f12
@@ -1511,8 +1510,7 @@ t3.sack_id = 33479 AND t3.kit_id = 6;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 5 Using index
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t4 index cat_id cat_id 4 NULL 19 Using index
+1 PRIMARY t4 ref cat_id cat_id 4 test.t3.cat_id 1 Using index; FirstMatch(t1)
SELECT count(*) FROM t1, t3
WHERE t1.cat_id = t3.cat_id AND
t3.cat_id IN (SELECT cat_id FROM t4) AND
@@ -1838,16 +1836,15 @@ explain
SELECT t2.id FROM t2,t1
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 30 Using index
-1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
-2 MATERIALIZED t3 ALL NULL NULL NULL NULL 14
-2 MATERIALIZED t1 eq_ref PRIMARY PRIMARY 4 test.t3.id 1 Using index
+1 PRIMARY t3 ALL NULL NULL NULL NULL 14 Using where; Start temporary
+1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t3.ref_id 1 Using where; Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.id 1 Using index; End temporary
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.ref_id 1 Using where; Using index
SELECT t2.id FROM t2,t1
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
id
-10
11
+10
set optimizer_switch='materialization=off';
SELECT t2.id FROM t2,t1
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
@@ -1946,17 +1943,17 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 18 Using index
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join)
3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12
-2 MATERIALIZED t2_1 ALL id_t2,id_product NULL NULL NULL 223 Using where
-4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where
5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where
+4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where
+2 MATERIALIZED t2_1 ALL id_t2,id_product NULL NULL NULL 223 Using where
6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where
set optimizer_switch='rowid_filter=default';
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result
index d1f8080bfaa..a782280da96 100644
--- a/mysql-test/main/subselect_sj_jcl6.result
+++ b/mysql-test/main/subselect_sj_jcl6.result
@@ -171,26 +171,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY s47 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
1 PRIMARY s48 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
1 PRIMARY s49 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m00 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY m02 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m03 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m04 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m05 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m06 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m07 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m08 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m09 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m10 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m11 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m12 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m13 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m14 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m15 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
-2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m00 ALL NULL NULL NULL NULL 3
+2 MATERIALIZED m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+2 MATERIALIZED m02 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m03 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m04 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m05 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m06 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m07 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m08 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m09 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m10 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m11 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m12 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m13 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m14 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m15 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+2 MATERIALIZED m19 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
select * from
t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
where t1.a < 5;
@@ -355,8 +355,8 @@ WHERE PNUM IN
(SELECT PNUM FROM PROJ));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY STAFF ALL NULL NULL NULL NULL 5
-1 PRIMARY PROJ ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
-1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF); Using join buffer (incremental, BNL join)
+1 PRIMARY PROJ ALL NULL NULL NULL NULL 6 Start temporary; Using join buffer (flat, BNL join)
+1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; End temporary; Using join buffer (incremental, BNL join)
SELECT EMPNUM, EMPNAME
FROM STAFF
WHERE EMPNUM IN
@@ -1621,9 +1621,9 @@ A.t1field IN (SELECT C.t2field FROM t2 C
WHERE C.t2field IN (SELECT D.t2field FROM t2 D));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A index PRIMARY PRIMARY 4 NULL 3 Using index
-1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(A); Using join buffer (flat, BNL join)
-1 PRIMARY C index PRIMARY PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (incremental, BNL join)
+1 PRIMARY C eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index
1 PRIMARY D eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index
+1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(D); Using join buffer (flat, BNL join)
SELECT * FROM t1 A
WHERE
A.t1field IN (SELECT A.t1field FROM t2 B) AND
@@ -2189,10 +2189,10 @@ INSERT INTO t5 VALUES (7,0),(9,0);
explain
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan
-1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where
-1 PRIMARY t4 ALL NULL NULL NULL NULL 3 FirstMatch(t5)
-1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; Start temporary
+1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (incremental, BNL join)
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
a
0
diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result
index b5f5099593d..4c88d3a78f1 100644
--- a/mysql-test/main/subselect_sj_mat.result
+++ b/mysql-test/main/subselect_sj_mat.result
@@ -380,7 +380,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00
5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 1 100.00 Using index
4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
@@ -439,7 +439,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery5> eq_ref distinct_key # # # 1 100.00 #
2 MATERIALIZED t2 ALL NULL # # # 5 100.00 #
5 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 # # # 5 75.00 #
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 #
4 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
3 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
7 UNION t1i range it1i1,it1i2,it1i3 # # # 3 100.00 #
@@ -475,7 +475,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
@@ -499,7 +499,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
@@ -2283,8 +2283,8 @@ WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
-2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
@@ -2317,8 +2317,8 @@ WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 index i2 i2 5 NULL 3 100.00 Using where; Using index
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 DEPENDENT SUBQUERY t2 range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
@@ -2356,8 +2356,8 @@ SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
@@ -2504,8 +2504,8 @@ alter table t1 add key(id);
explain
SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index id id 4 NULL 9 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
1
@@ -2561,8 +2561,8 @@ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2;
explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index id id 4 NULL 9 Using index
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
1
diff --git a/mysql-test/main/table_elim.result b/mysql-test/main/table_elim.result
index 4da85c4a9ca..4b9956a4e48 100644
--- a/mysql-test/main/table_elim.result
+++ b/mysql-test/main/table_elim.result
@@ -563,9 +563,9 @@ JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4
WHERE t3.f2 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t2 ref f4 f4 1003 test.t3.f4 2 Using where
1 SIMPLE t5 ref f5 f5 5 test.t3.f1 2 Using where; Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL f4 NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
# ^^ The above must not produce a QEP of t3,t5,t2,t4
# as that violates the "no interleaving of outer join nests" rule.
DROP TABLE t1,t2,t3,t4,t5;
diff --git a/mysql-test/main/type_time_6065.result b/mysql-test/main/type_time_6065.result
index 56de96870b6..5df612e3001 100644
--- a/mysql-test/main/type_time_6065.result
+++ b/mysql-test/main/type_time_6065.result
@@ -2267,8 +2267,8 @@ outr.col_varchar_key IS NULL
);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY outr system col_datetime_key NULL NULL NULL 1 100.00
+1 PRIMARY outr2 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-1 PRIMARY outr2 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED innr ref col_int_key col_int_key 4 const 2 100.00 Using where
Warnings:
Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where `test`.`innr`.`col_int_key` = 1 and `test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey` and `test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55'
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index a089ca43edd..aab13d191a4 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -565,7 +565,7 @@ explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
-2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+2 UNION t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity,@@optimizer_switch=@save_optimizer_switch;
explain (select * from t1 where a=1) union (select * from t1 where b=1);
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 3383d4b6826..d390b395d28 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -3290,8 +3290,8 @@ EXPLAIN
SELECT t2.b FROM t1,t2 WHERE t1.a IN (SELECT 1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t2 index NULL PRIMARY 4 NULL 1 Using index; FirstMatch(t1); Using join buffer (incremental, BNL join)
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 1 Using index; Start temporary; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join)
SELECT t2.b FROM t1,t2 WHERE t1.a IN (SELECT 1 FROM t2);
b
1
diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result
index cc42f81e3c4..066f1a50aab 100644
--- a/mysql-test/suite/maria/mrr.result
+++ b/mysql-test/suite/maria/mrr.result
@@ -404,8 +404,8 @@ FROM t1 AS table1, t2 AS table2
WHERE
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE table2 ALL NULL NULL NULL NULL 2
-1 SIMPLE table1 ALL PRIMARY,col_varchar_1024_latin1_key NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE table2 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE table1 ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1027 test.table2.col_varchar_10_latin1 2 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT count(*)
FROM t1 AS table1, t2 AS table2
WHERE
diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result
index 301c9defb6d..16e4e9f1ce1 100644
--- a/mysql-test/suite/vcol/r/vcol_select_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result
@@ -73,8 +73,8 @@ a b c
1 -1 -1
explain select * from t1 where c in (select c from t3 where c between -2 and -1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 range c c 5 NULL 2 Using where; Using index
-1 PRIMARY t1 ref c c 5 test.t3.c 2
+1 PRIMARY t1 range c c 5 NULL 3 Using index condition
+1 PRIMARY t3 eq_ref c c 5 test.t1.c 1 Using index
# select_type=UNION, type=system
# select_type=UNION RESULT, type=<union1,2>
select * from t1 union select * from t2;
diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc
index 6dd54d259c0..8e723036b97 100644
--- a/sql/opt_trace.cc
+++ b/sql/opt_trace.cc
@@ -677,6 +677,10 @@ void print_final_join_order(JOIN *join)
for (j= join->join_tab,i=0 ; i < join->top_join_tab_count;
i++, j++)
best_order.add_table_name(j);
+ best_order.end();
+
+ /* Write information about the resulting join */
+ join_order.add("cost", join->best_read);
}
diff --git a/sql/rowid_filter.cc b/sql/rowid_filter.cc
index 22e46c3f42d..8cd2a5aeddb 100644
--- a/sql/rowid_filter.cc
+++ b/sql/rowid_filter.cc
@@ -23,7 +23,6 @@
#include "opt_trace.h"
-inline
double Range_rowid_filter_cost_info::
lookup_cost(Rowid_filter_container_type cont_type)
{
diff --git a/sql/rowid_filter.h b/sql/rowid_filter.h
index bcafb35d142..2bd21b5db79 100644
--- a/sql/rowid_filter.h
+++ b/sql/rowid_filter.h
@@ -390,7 +390,7 @@ public:
whether usage of the range filter promises some gain.
*/
-class Range_rowid_filter_cost_info : public Sql_alloc
+class Range_rowid_filter_cost_info final: public Sql_alloc
{
/* The table for which the range filter is to be built (if needed) */
TABLE *table;
@@ -430,7 +430,8 @@ public:
double build_cost(Rowid_filter_container_type container_type);
- inline double lookup_cost(Rowid_filter_container_type cont_type);
+ double lookup_cost(Rowid_filter_container_type cont_type);
+ inline double lookup_cost() { return lookup_cost(container_type); }
inline double
avg_access_and_eval_gain_per_row(Rowid_filter_container_type cont_type);
@@ -462,6 +463,8 @@ public:
Rowid_filter_container *create_container();
+ double get_setup_cost() { return cost_of_building_range_filter; }
+ double get_lookup_cost();
double get_gain() { return gain; }
uint get_key_no() { return key_no; }
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3c443b56317..0243fe67605 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -83,6 +83,12 @@
*/
#define FT_KEYPART (MAX_FIELDS+10)
+/*
+ We assume that when we do hash join, only 10 % rows in the hash will
+ match the current found row.
+*/
+#define HASH_FANOUT 0.1
+
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext",
"ref_or_null","unique_subquery","index_subquery",
@@ -7699,7 +7705,7 @@ void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key)
@param s Current JOIN_TAB
@param with_found_constraint There is a filtering condition on the
- current table of type. See below.
+ current table. See more below.
@param use_cond_selectivity Value of optimizer_use_condition_selectivity.
If > 1 then use table->cond_selecitivity.
@@ -7778,6 +7784,7 @@ static double matching_candidates_in_table(JOIN_TAB *s,
if (with_found_constraint)
dbl_records-= dbl_records/4;
+ DBUG_ASSERT(dbl_records <= s->records);
/*
Ensure we return at least one row if there is any possibility to have
a matching row. Having rows >= 1.0 helps ensure that when we calculate
@@ -7891,10 +7898,8 @@ best_access_path(JOIN *join,
KEYUSE *best_key= 0;
uint best_max_key_part= 0;
my_bool found_constraint= 0;
- double best= DBL_MAX;
- double best_time= DBL_MAX;
+ double best_cost= DBL_MAX;
double records= DBL_MAX;
- ha_rows records_for_key;
double best_filter_cmp_gain;
table_map best_ref_depends_map= 0;
/*
@@ -7912,8 +7917,6 @@ best_access_path(JOIN *join,
MY_BITMAP *eq_join_set= &s->table->eq_join_set;
KEYUSE *hj_start_key= 0;
SplM_plan_info *spl_plan= 0;
- Range_rowid_filter_cost_info *filter= 0;
- const char* cause= NULL;
enum join_type best_type= JT_UNKNOWN, type= JT_UNKNOWN;
disable_jbuf= disable_jbuf || idx == join->const_tables;
@@ -7946,19 +7949,23 @@ best_access_path(JOIN *join,
for (keyuse=s->keyuse ; keyuse->table == table ;)
{
KEY *keyinfo;
+ const char *cause= NULL;
ulong key_flags;
uint key_parts;
key_part_map found_part= 0;
- key_part_map notnull_part=0; // key parts which won't have NULL in lookup tuple.
+ /* key parts which won't have NULL in lookup tuple */
+ key_part_map notnull_part=0;
table_map found_ref= 0;
uint key= keyuse->key;
- filter= 0;
bool ft_key= (keyuse->keypart == FT_KEYPART);
/* Bitmap of keyparts where the ref access is over 'keypart=const': */
key_part_map const_part= 0;
/* The or-null keypart in ref-or-null access: */
key_part_map ref_or_null_part= 0;
key_part_map all_parts= 0;
+ double startup_cost= s->startup_cost;
+ double records_after_filter;
+ Range_rowid_filter_cost_info *filter= 0;
if (is_hash_join_key_no(key))
{
@@ -8066,10 +8073,14 @@ best_access_path(JOIN *join,
if (ft_key)
{
/*
+ Calculate an adjusted cost based on how many records are read
+ This will be later multipled by record_count.
+ */
+ tmp= prev_record_reads(join_positions, idx, found_ref)/record_count;
+ /*
Really, there should be records=0.0 (yes!)
but 1.0 would be probably safer
*/
- tmp= prev_record_reads(join_positions, idx, found_ref);
records= 1.0;
type= JT_FT;
trace_access_idx.add("access_type", join_type_str[type])
@@ -8104,7 +8115,12 @@ best_access_path(JOIN *join,
tmp= adjust_quick_cost(table->opt_range[key].cost, 1);
else
tmp= table->file->avg_io_cost();
- tmp*= prev_record_reads(join_positions, idx, found_ref);
+ /*
+ Calculate an adjusted cost based on how many records are read
+ This will be later multipled by record_count.
+ */
+ tmp*= (prev_record_reads(join_positions, idx, found_ref) /
+ record_count);
records=1.0;
}
else
@@ -8137,15 +8153,12 @@ best_access_path(JOIN *join,
trace_access_idx.add("used_range_estimates", true);
tmp= adjust_quick_cost(table->opt_range[key].cost,
table->opt_range[key].rows);
- goto got_cost;
- }
- else
- {
- /* quick_range couldn't use key! */
- records= (double) s->records/rec;
- trace_access_idx.add("used_range_estimates", false)
- .add("reason", "not available");
+ goto got_cost2;
}
+ /* quick_range couldn't use key! */
+ records= (double) s->records/rec;
+ trace_access_idx.add("used_range_estimates", false)
+ .add("reason", "not available");
}
else
{
@@ -8193,15 +8206,9 @@ best_access_path(JOIN *join,
}
}
}
- /* Limit the number of matched rows */
+ /* Calculate the cost of the index access */
tmp= cost_for_index_read(thd, table, key, (ha_rows) records,
(ha_rows) s->worst_seeks);
- records_for_key= (ha_rows) records;
- set_if_smaller(records_for_key, thd->variables.max_seeks_for_key);
- keyread_tmp= table->file->keyread_time(key, 1, records_for_key);
- got_cost:
- tmp= COST_MULT(tmp, record_count);
- keyread_tmp= COST_MULT(keyread_tmp, record_count);
}
}
else
@@ -8212,7 +8219,8 @@ best_access_path(JOIN *join,
/*
Use as much key-parts as possible and a uniq key is better
than a not unique key
- Set tmp to (previous record count) * (records / combination)
+ Set tmp to the cost of the accessing the expected number of
+ records.
*/
if ((found_part & 1) &&
(!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) ||
@@ -8375,35 +8383,39 @@ best_access_path(JOIN *join,
}
}
- /* Limit the number of matched rows */
+ set_if_smaller(records, (double) s->records);
tmp= cost_for_index_read(thd, table, key, (ha_rows) records,
(ha_rows) s->worst_seeks);
- records_for_key= (ha_rows) records;
- set_if_smaller(records_for_key, thd->variables.max_seeks_for_key);
- keyread_tmp= table->file->keyread_time(key, 1, records_for_key);
- got_cost2:
- tmp= COST_MULT(tmp, record_count);
- keyread_tmp= COST_MULT(keyread_tmp, record_count);
}
else
{
if (!(found_part & 1))
cause= "no predicate for first keypart";
- tmp= best_time; // Do nothing
+ else
+ cause= "No full key found";
+ trace_access_idx.add("chosen", false).add("cause", cause);
+ continue;
}
}
- tmp= COST_ADD(tmp, s->startup_cost);
- loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp,
+ got_cost2:
+ loose_scan_opt.check_ref_access_part2(key, start_key, records,
+ tmp + startup_cost,
found_ref);
} /* not ft_key */
- if (records < DBL_MAX &&
- (found_part & 1) && // start_key->key can be used for index access
+ if (records == DBL_MAX) // Key not usable
+ continue;
+
+ startup_cost= s->startup_cost;
+ records_after_filter= records;
+
+ if ((found_part & 1) && // start_key->key can be used for index access
(table->file->index_flags(start_key->key,0,1) &
HA_DO_RANGE_FILTER_PUSHDOWN))
{
double rows= record_count * records;
+ double access_cost_factor= MY_MIN(tmp / records, 1.0);
/*
If we use filter F with selectivity s the the cost of fetching data
@@ -8425,7 +8437,6 @@ best_access_path(JOIN *join,
Here we have:
cost_of_fetching_1_row = tmp/rows
cost_of_fetching_1_key_tuple = keyread_tmp/rows
-
access_cost_factor is the gain we expect for using rowid filter.
An access_cost_factor of 1.0 means that keyread_tmp is 0
(using key read is infinitely fast) and the gain for each row when
@@ -8450,35 +8461,62 @@ best_access_path(JOIN *join,
We cannot use filter with JT_EQ_REF as in this case 'tmp' is
number of rows from prev_record_read() and keyread_tmp is 0. These
numbers are not usable with rowid filter code.
- */
- double access_cost_factor= MY_MIN((rows - keyread_tmp) / rows, 1.0);
- if (!(records < s->worst_seeks &&
- records <= thd->variables.max_seeks_for_key))
- trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping");
- else if (access_cost_factor <= 0.0)
- trace_access_idx.add("rowid_filter_skipped", "cost_factor <= 0");
- else if (type != JT_EQ_REF)
- {
- filter=
- table->best_range_rowid_filter_for_partial_join(start_key->key,
- rows,
- access_cost_factor);
- if (filter)
+ */
+ filter=
+ table->best_range_rowid_filter_for_partial_join(start_key->key, rows,
+ access_cost_factor);
+ if (filter)
+ {
+ double new_cost, new_records;
+ bool use_filter;
+ double filter_startup_cost= filter->get_setup_cost();
+ double filter_lookup_cost= records * filter->lookup_cost();
+
+ /* Add cost of checking found rows against filter */
+ new_cost= COST_ADD(tmp, filter_lookup_cost);
+ /* Calculate number of resulting rows after filtering */
+ new_records= records * filter->selectivity;
+ DBUG_ASSERT(new_cost >= 0 && new_records >= 0);
+ use_filter= ((tmp + records/TIME_FOR_COMPARE) * record_count >=
+ (new_cost + new_records/TIME_FOR_COMPARE)*record_count +
+ filter_startup_cost);
+
+ if (thd->trace_started())
{
- tmp-= filter->get_adjusted_gain(rows) - filter->get_cmp_gain(rows);
- DBUG_ASSERT(tmp >= 0);
- trace_access_idx.add("rowid_filter_key",
- table->key_info[filter->get_key_no()].name);
+ Json_writer_object trace_filter(thd, "filter");
+ trace_filter.add("rowid_filter_key",
+ table->key_info[filter->get_key_no()].name).
+ add("original_found_rows_cost", tmp).
+ add("new_found_rows_cost", new_cost).
+ add("orginal_rows", records).
+ add("new_rows", new_records).
+ add("filter_startup_cost", filter_startup_cost).
+ add("filter_lookup_cost", filter_lookup_cost).
+ add("filter_selectivity", filter->selectivity).
+ add("filter_used", use_filter);
}
+ if (use_filter)
+ {
+ tmp= new_cost;
+ records_after_filter= new_records;
+ startup_cost+= filter_startup_cost;
+ }
+ else
+ filter= 0;
}
}
- trace_access_idx.add("rows", records).add("cost", tmp);
+ tmp= COST_ADD(tmp, records_after_filter/TIME_FOR_COMPARE);
+ trace_access_idx.
+ add("rows", records).
+ add("cond_check_cost",tmp).
+ add("startup_cost", startup_cost);
- if (tmp + 0.0001 < best_time - records/TIME_FOR_COMPARE)
+ tmp= COST_MULT(tmp, record_count);
+ tmp= COST_ADD(tmp, startup_cost);
+ if (tmp + 0.0001 < best_cost)
{
- trace_access_idx.add("chosen", true);
- best_time= COST_ADD(tmp, records/TIME_FOR_COMPARE);
- best= tmp;
+ trace_access_idx.add("cost", tmp).add("chosen", true);
+ best_cost= tmp;
best_records= records;
best_key= start_key;
best_max_key_part= max_key_part;
@@ -8486,12 +8524,11 @@ best_access_path(JOIN *join,
best_filter= filter;
best_type= type;
}
- else
+ else if (thd->trace_started())
{
- trace_access_idx.add("chosen", false)
+ trace_access_idx.add("cost",tmp).add("chosen", false)
.add("cause", cause ? cause : "cost");
}
- cause= nullptr;
} /* for each key */
records= best_records;
}
@@ -8512,15 +8549,19 @@ best_access_path(JOIN *join,
*/
if (s->key_start_dependent)
key_dependent= s->key_dependent;
- /* Add dependencey for sub queries */
+
+ /* Add dependency for sub queries */
key_dependent|= s->embedded_dependent;
- }
+
+ } /* if (s->keyuse) */
+
+
/* Check that s->key_dependent contains all used_tables found in s->keyuse */
key_dependent&= ~PSEUDO_TABLE_BITS;
DBUG_ASSERT((key_dependent & (s->key_dependent | s->embedded_dependent)) ==
key_dependent);
- /*
+ /*
If there is no key to access the table, but there is an equi-join
predicate connecting the table with the privious tables then we
consider the possibility of using hash join.
@@ -8537,25 +8578,48 @@ best_access_path(JOIN *join,
(!(s->table->map & join->outer_join) ||
join->allowed_outer_join_with_cache)) // (2)
{
- double join_sel= 0.1;
- double refills;
+ double refills, cmp_time;
/* Estimate the cost of the hash join access to the table */
double rnd_records= matching_candidates_in_table(s, found_constraint,
use_cond_selectivity);
-
- tmp= s->quick ? s->quick->read_time : s->scan_time();
- double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE;
- tmp= COST_ADD(tmp, cmp_time);
+ /*
+ The following cost calculation is identical to the cost calculation for
+ the join cache later on, except for the HASH_FANOUT
+ */
+ if (s->quick)
+ {
+ /*
+ Cost of reading rows through opt_range including comparing the rows
+ with the attached WHERE clause.
+ */
+ tmp= s->quick->read_time;
+ }
+ else
+ {
+ tmp= s->scan_time();
+ /*
+ Cost of comparing the found row with the attached WHERE
+ This is not part of scan_time()!
+ */
+ tmp= COST_ADD(tmp, s->records / TIME_FOR_COMPARE);
+ }
/* We read the table as many times as join buffer becomes full. */
refills= (1.0 + floor((double) cache_record_length(join,idx) *
record_count /
(double) thd->variables.join_buff_size));
tmp= COST_MULT(tmp, refills);
- best_time= COST_ADD(tmp,
- COST_MULT((record_count*join_sel) / TIME_FOR_COMPARE,
- rnd_records));
- best= tmp;
+
+ /*
+ Cost of doing the hash lookup and check all matching rows with the
+ WHERE clause.
+ We assume here that, thanks to the hash, we don't have to compare all
+ row combinations, only a HASH_FANOUT (10%) rows in the cache.
+ */
+ cmp_time= (rnd_records * record_count * HASH_FANOUT / TIME_FOR_COMPARE);
+ tmp= COST_ADD(tmp, cmp_time);
+
+ best_cost= tmp;
records= rnd_records;
best_key= hj_start_key;
best_ref_depends_map= 0;
@@ -8565,8 +8629,8 @@ best_access_path(JOIN *join,
Json_writer_object trace_access_hash(thd);
trace_access_hash.add("type", "hash");
trace_access_hash.add("index", "hj-key");
- trace_access_hash.add("rnd_records", rnd_records);
- trace_access_hash.add("cost", best);
+ trace_access_hash.add("rows", rnd_records);
+ trace_access_hash.add("cost", best_cost);
trace_access_hash.add("chosen", true);
}
@@ -8606,7 +8670,7 @@ best_access_path(JOIN *join,
be used for cases with small datasets, which is annoying.
*/
Json_writer_object trace_access_scan(thd);
- if ((records >= s->found_records || best > s->read_time) && // (1)
+ if ((records >= s->found_records || best_cost > s->read_time) && // (1)
!(best_key && best_key->key == MAX_KEY) && // (2)
!(s->quick &&
s->quick->get_type() != QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX && // (2)
@@ -8619,6 +8683,8 @@ best_access_path(JOIN *join,
{ // Check full join
double rnd_records= matching_candidates_in_table(s, found_constraint,
use_cond_selectivity);
+ Range_rowid_filter_cost_info *filter= 0;
+ DBUG_ASSERT(rnd_records <= s->records);
/*
Range optimizer never proposes a RANGE if it isn't better
@@ -8626,7 +8692,6 @@ best_access_path(JOIN *join,
Here we estimate its cost.
*/
- filter= 0;
if (s->quick)
{
/*
@@ -8642,9 +8707,7 @@ best_access_path(JOIN *join,
access (see first else-branch below), but we don't take it into
account here for range/index_merge access. Find out why this is so.
*/
- double cmp_time= (s->found_records - rnd_records) / TIME_FOR_COMPARE;
- tmp= COST_MULT(record_count,
- COST_ADD(s->quick->read_time, cmp_time));
+ tmp= COST_MULT(s->quick->read_time, record_count);
if ( s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE)
{
@@ -8694,34 +8757,52 @@ best_access_path(JOIN *join,
type= JT_ALL;
}
- if ((s->table->map & join->outer_join) || disable_jbuf) // Can't use join cache
+ if ((s->table->map & join->outer_join) || disable_jbuf)
{
+ double cmp_time;
/*
Simple scan
For each record we have to:
- Read the whole table record
- - Compare with the current where clause with only fields for the table
+ - Compare with the current where clause with only fields for the
+ table
- Compare with the full where and skip rows which does not satisfy
the join condition
*/
- double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE;
- tmp= COST_MULT(record_count, COST_ADD(tmp,cmp_time));
+ /* Calculate cost of checking the attached WHERE */
+ cmp_time= s->records/TIME_FOR_COMPARE;
+ tmp= COST_ADD(tmp, cmp_time);
+ /*
+ If this is not the first table we have to compare the rows against
+ all previous row combinations
+ */
+ if (idx != join->const_tables)
+ {
+ /* Calculate cost of checking matched rows against the join cache */
+ cmp_time= rnd_records/TIME_FOR_COMPARE;
+ tmp= COST_ADD(tmp, cmp_time);
+ /* We do the above for every row in the cache */
+ tmp= COST_MULT(tmp, record_count);
+ }
}
else
{
- double refills= (1.0 + floor((double) cache_record_length(join,idx) *
- (record_count /
- (double) thd->variables.join_buff_size)));
+ /* Scan trough join cache */
+ double cmp_time, refills;
+
+ /* Calculate cost of checking the attached WHERE */
+ cmp_time= s->records / TIME_FOR_COMPARE;
+ tmp= COST_ADD(tmp, cmp_time);
+
+ /* Calculate cost of refills */
+ refills= (1.0 + floor((double) cache_record_length(join,idx) *
+ (record_count /
+ (double) thd->variables.join_buff_size)));
tmp= COST_MULT(tmp, refills);
- /*
- We don't make full cartesian product between rows in the scanned
- table and existing records because we skip all rows from the
- scanned table, which does not satisfy join condition when
- we read the table (see flush_cached_records for details). Here we
- take into account cost to read and skip these records.
- */
- double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE;
+
+ /* Cost of compare matching rows against the rows in the join cache */
+ cmp_time= (rnd_records * record_count / TIME_FOR_COMPARE);
tmp= COST_ADD(tmp, cmp_time);
}
}
@@ -8735,34 +8816,30 @@ best_access_path(JOIN *join,
else
tmp+= s->startup_cost;
- /*
- We estimate the cost of evaluating WHERE clause for found records
- as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus
- tmp give us total cost of using TABLE SCAN
- */
-
best_filter_cmp_gain= (best_filter ?
best_filter->get_cmp_gain(record_count * records) :
0);
trace_access_scan.add("resulting_rows", rnd_records);
trace_access_scan.add("cost", tmp);
- if (best == DBL_MAX ||
- COST_ADD(tmp, record_count/TIME_FOR_COMPARE*rnd_records) <
- (best_key->is_for_hash_join() ? best_time :
- COST_ADD(best - best_filter_cmp_gain,
- record_count/TIME_FOR_COMPARE*records)))
+ /* TODO: Document the following if */
+ if (best_cost == DBL_MAX ||
+ tmp <
+ (best_key->is_for_hash_join() ? best_cost :
+ COST_ADD(best_cost,-best_filter_cmp_gain)))
{
/*
If the table has a range (s->quick is set) make_join_select()
will ensure that this will be used
*/
- best= tmp;
+ best_cost= tmp;
records= rnd_records;
best_key= 0;
- best_filter= 0;
- if (s->quick && s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE)
- best_filter= filter;
+ /*
+ filter is only set if
+ s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE
+ */
+ best_filter= filter;
/* range/index_merge/ALL/index access method are "independent", so: */
best_ref_depends_map= 0;
best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map &
@@ -8781,7 +8858,7 @@ best_access_path(JOIN *join,
/* Update the cost information for the current partial plan */
pos->records_read= records;
- pos->read_time= best;
+ pos->read_time= best_cost;
pos->key= best_key;
pos->type= best_type;
pos->table= s;
@@ -10655,14 +10732,11 @@ best_extension_by_limited_search(JOIN *join,
partial_join_cardinality= (current_record_count *
pushdown_cond_selectivity);
- if (unlikely(thd->trace_started()))
+ if (unlikely(thd->trace_started()) && pushdown_cond_selectivity < 1.0)
{
- if (pushdown_cond_selectivity < 1.0)
- {
- trace_one_table.add("selectivity", pushdown_cond_selectivity);
- trace_one_table.add("estimated_join_cardinality",
- partial_join_cardinality);
- }
+ trace_one_table.add("selectivity", pushdown_cond_selectivity);
+ trace_one_table.add("estimated_join_cardinality",
+ partial_join_cardinality);
}
if ((search_depth > 1) &&
@@ -14591,6 +14665,9 @@ void JOIN_TAB::cleanup()
/**
Estimate the time to get rows of the joined table
+
+ Note that this doesn't take into account of checking the WHERE clause
+ for all found rows (TIME_FOR_COMPARE)
*/
double JOIN_TAB::scan_time()
@@ -29629,7 +29706,7 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
range_cond(key_part+1).
*/
if (kp == table->opt_range[keynr].key_parts)
- ref_rows= table->opt_range[keynr].rows;
+ ref_rows= best_rows;
else
ref_rows= (ha_rows) table->key_info[keynr].actual_rec_per_key(kp-1);
@@ -29794,7 +29871,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
}
}
else
- read_time= table->file->scan_time();
+ read_time= table->file->scan_time(); // TODO: Add TIME_FOR_COMPARE
trace_cheaper_ordering.add("fanout", fanout);
/*
@@ -29998,8 +30075,15 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
to calculate the cost of accessing data rows for one
index entry.
*/
- index_scan_time= select_limit/rec_per_key *
- MY_MIN(rec_per_key, table->file->scan_time());
+#ifdef NEED_TESTING
+ index_scan_time= (cost_for_index_read(table->in_use, table, nr,
+ select_limit,
+ (ha_rows) tab->worst_seeks) +
+ select_limit / TIME_FOR_COMPARE);
+#else
+ index_scan_time= (select_limit/rec_per_key *
+ MY_MIN(rec_per_key, table->file->scan_time()));
+#endif
double range_scan_time;
if (get_range_limit_read_cost(tab, table, table_records, nr,
select_limit, &range_scan_time))
diff --git a/storage/connect/mysql-test/connect/r/index.result b/storage/connect/mysql-test/connect/r/index.result
index baebf1f1ebe..2197f9bcf1e 100644
--- a/storage/connect/mysql-test/connect/r/index.result
+++ b/storage/connect/mysql-test/connect/r/index.result
@@ -98,16 +98,16 @@ sexe genre
2 Feminin
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
nom prenom genre
-ESCOURCHE BENEDICTE Feminin
-VICENTE LAURENCE Feminin
NICOLAS ROGER Masculin
-TESSEREAU MARIE HELENE Feminin
MOGADOR ALAIN Masculin
CHAUSSEE ERIC DENIS Masculin
MAILLOT GEORGES Masculin
-CAMILLE NADINE Feminin
BRUYERES JEAN MARC Masculin
LONES GERARD Masculin
+CROISILLES DOMINIQUE Masculin
+SEYSSAUD GERARD Masculin
+QUINET OLIVIER Masculin
+KOMITAS YVES Masculin
#
# Another table
#
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
index 4adfb1bd76a..83ec42044a5 100644
--- a/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
+++ b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
@@ -87,7 +87,7 @@ a b c a
connection child2_1;
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
argument
-select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on (t3.`b` = t2.`b`) where 1 order by t0.`a` desc
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on ((t1.`a` = t0.`a`) and (t0.`a` is not null)) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on ((t3.`b` = t2.`b`) and (t2.`b` is not null)) where 1 order by t0.`a` desc
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
index 438f54f6ce6..ff4f211faf5 100644
--- a/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
@@ -87,7 +87,7 @@ NULL NULL NULL 3
connection child2_1;
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
argument
-select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t3.`b` is not null) and (t1.`a` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
index 5101ea5036a..02f985279f8 100644
--- a/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
+++ b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
@@ -87,7 +87,7 @@ NULL c 2000-01-03 00:00:00 3
connection child2_1;
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
argument
-select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on (t2.`b` = t3.`b`) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on ((t2.`b` = t3.`b`) and (t3.`b` is not null)) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
index 67d688e1383..840328508fa 100644
--- a/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
@@ -87,7 +87,7 @@ NULL c 2000-01-03 00:00:00 3
connection child2_1;
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
argument
-select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t1.`c` = t2.`c`)) where 1 order by t3.`a` desc
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t1.`c` = t2.`c`) and (t3.`b` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')