diff options
author | Oleg Smirnov <olernov@gmail.com> | 2022-06-27 12:37:59 +0700 |
---|---|---|
committer | Oleg Smirnov <olernov@gmail.com> | 2022-07-04 21:19:35 +0700 |
commit | 3485ad9fd5436c7d5aa0947a141550414b3a312d (patch) | |
tree | 5c422e2fefab87ef3ea8ba223563591fae200fa8 /sql/sql_select.cc | |
parent | f332260c9872a428f68e0461329bb5fa29461592 (diff) | |
download | mariadb-git-bb-10.10-MDEV-28869.tar.gz |
MDEV-28869 Eliminated tables are not shown in EXPLAINbb-10.10-MDEV-28869
Show tables that have been eliminated during optimization stage
in the output of EXPLAIN/ANALYZE [FORMAT=JSON] commands. Show both
regular and derived tables.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3b07122e7c1..33f02d64744 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -28228,19 +28228,17 @@ int JOIN::save_explain_data_intern(Explain_query *output, JOIN_TAB *saved_join_tab= NULL; TABLE *cur_table= tab->table; - /* Don't show eliminated tables */ - if (cur_table->map & join->eliminated_tables) - { - used_tables|= cur_table->map; - continue; - } - Explain_table_access *eta= (new (output->mem_root) Explain_table_access(output->mem_root)); if (!eta) DBUG_RETURN(1); + if (cur_table->map & join->eliminated_tables) + { + eta->is_eliminated= true; + } + if (tab->bush_root_tab != prev_bush_root_tab) { if (tab->bush_root_tab) @@ -28293,7 +28291,8 @@ int JOIN::save_explain_data_intern(Explain_query *output, tmp_unit; tmp_unit= tmp_unit->next_unit()) if (tmp_unit->explainable()) - explain->add_child(tmp_unit->first_select()->select_number); + explain->add_child(tmp_unit->first_select()->select_number, + tmp_unit->is_eliminated()); if (select_lex->is_top_level_node()) output->query_plan_ready(); @@ -28355,7 +28354,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, DBUG_ASSERT(ref == unit->item); } - if (unit->explainable()) + if (unit->explainable() && !unit->is_eliminated()) { if (mysql_explain_union(thd, unit, result)) DBUG_VOID_RETURN; |