MDEV-20440: Optimizer trace: print more details about semi-join optimization

Followup patch: fix typos
This commit is contained in:
Sergei Petrunia 2019-09-12 19:07:56 +03:00
parent 60c04be659
commit d0b74bbacc
2 changed files with 17 additions and 8 deletions

View file

@ -2970,7 +2970,7 @@ explain extended select * from t1 where a in (select pk from t10) {
"read_time": 27.129
},
{
"chosen_strategy": "SJ-Materialize"
"chosen_strategy": "SJ-Materialization"
}
],
"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_
"read_time": 18.315
},
{
"chosen_strategy": "SJ-Materialize"
"chosen_strategy": "SJ-Materialization"
}
],
"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) {
]
},
{
"fix_semijoin_strategies_for_picked_join_order": []
"fix_semijoin_strategies_for_picked_join_order": [
{
"semi_join_strategy": "DuplicateWeedout"
},
{
"semi_join_strategy": "DuplicateWeedout"
}
]
},
{
"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) {
"read_time": 37.226
},
{
"chosen_strategy": "SJ-Materialize"
"chosen_strategy": "SJ-Materialization"
}
],
"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) {
"read_time": 294.96
},
{
"chosen_strategy": "SJ-Materialize"
"chosen_strategy": "SJ-Materialization"
}
],
"estimated_join_cardinality": 27

View file

@ -2938,10 +2938,10 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
const char *sname;
switch (pos->sj_strategy) {
case SJ_OPT_MATERIALIZE:
sname= "SJ-Materialize";
sname= "SJ-Materialization";
break;
case SJ_OPT_MATERIALIZE_SCAN:
sname= "SJ-Materialize-Scan";
sname= "SJ-Materialization-Scan";
break;
case SJ_OPT_FIRST_MATCH:
sname= "FirstMatch";
@ -3203,7 +3203,7 @@ bool LooseScan_picker::check_qep(JOIN *join,
(new_join_tab->table->map & loosescan_need_tables))
{
Json_writer_object trace(join->thd);
trace.add("strategy", "SJ-Materialization-Scan");
trace.add("strategy", "LooseScan");
/*
Ok we have LooseScan plan and also have all LooseScan sj-nest's
inner tables and outer correlated tables into the prefix.
@ -3899,6 +3899,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
if (pos->sj_strategy == SJ_OPT_DUPS_WEEDOUT)
{
Json_writer_object semijoin_strategy(thd);
semijoin_strategy.add("semi_join_strategy","DuplicateWeedout");
/*
Duplicate Weedout starting at pos->first_dupsweedout_table, ending at
this table.