Skip to content

Commit d0b74bb

Browse files
committed
MDEV-20440: Optimizer trace: print more details about semi-join optimization
Followup patch: fix typos
1 parent 60c04be commit d0b74bb

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

mysql-test/main/opt_trace.result

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,7 @@ explain extended select * from t1 where a in (select pk from t10) {
29702970
"read_time": 27.129
29712971
},
29722972
{
2973-
"chosen_strategy": "SJ-Materialize"
2973+
"chosen_strategy": "SJ-Materialization"
29742974
}
29752975
],
29762976
"estimated_join_cardinality": 3
@@ -4609,7 +4609,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
46094609
"read_time": 18.315
46104610
},
46114611
{
4612-
"chosen_strategy": "SJ-Materialize"
4612+
"chosen_strategy": "SJ-Materialization"
46134613
}
46144614
],
46154615
"estimated_join_cardinality": 3
@@ -6309,7 +6309,14 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
63096309
]
63106310
},
63116311
{
6312-
"fix_semijoin_strategies_for_picked_join_order": []
6312+
"fix_semijoin_strategies_for_picked_join_order": [
6313+
{
6314+
"semi_join_strategy": "DuplicateWeedout"
6315+
},
6316+
{
6317+
"semi_join_strategy": "DuplicateWeedout"
6318+
}
6319+
]
63136320
},
63146321
{
63156322
"best_join_order": [
@@ -6833,7 +6840,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
68336840
"read_time": 37.226
68346841
},
68356842
{
6836-
"chosen_strategy": "SJ-Materialize"
6843+
"chosen_strategy": "SJ-Materialization"
68376844
}
68386845
],
68396846
"rest_of_plan": [
@@ -6935,7 +6942,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
69356942
"read_time": 294.96
69366943
},
69376944
{
6938-
"chosen_strategy": "SJ-Materialize"
6945+
"chosen_strategy": "SJ-Materialization"
69396946
}
69406947
],
69416948
"estimated_join_cardinality": 27

sql/opt_subselect.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,10 +2938,10 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
29382938
const char *sname;
29392939
switch (pos->sj_strategy) {
29402940
case SJ_OPT_MATERIALIZE:
2941-
sname= "SJ-Materialize";
2941+
sname= "SJ-Materialization";
29422942
break;
29432943
case SJ_OPT_MATERIALIZE_SCAN:
2944-
sname= "SJ-Materialize-Scan";
2944+
sname= "SJ-Materialization-Scan";
29452945
break;
29462946
case SJ_OPT_FIRST_MATCH:
29472947
sname= "FirstMatch";
@@ -3203,7 +3203,7 @@ bool LooseScan_picker::check_qep(JOIN *join,
32033203
(new_join_tab->table->map & loosescan_need_tables))
32043204
{
32053205
Json_writer_object trace(join->thd);
3206-
trace.add("strategy", "SJ-Materialization-Scan");
3206+
trace.add("strategy", "LooseScan");
32073207
/*
32083208
Ok we have LooseScan plan and also have all LooseScan sj-nest's
32093209
inner tables and outer correlated tables into the prefix.
@@ -3899,6 +3899,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
38993899

39003900
if (pos->sj_strategy == SJ_OPT_DUPS_WEEDOUT)
39013901
{
3902+
Json_writer_object semijoin_strategy(thd);
3903+
semijoin_strategy.add("semi_join_strategy","DuplicateWeedout");
39023904
/*
39033905
Duplicate Weedout starting at pos->first_dupsweedout_table, ending at
39043906
this table.

0 commit comments

Comments
 (0)