Commit 1dd5d31c authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-406: ANALYZE $stmt: fix order_by.test

In JOIN_TAB::update_explain_data(), take into account that
- the table that may have pre-sorted is the first non-const table
- Tables that are eliminated by table elimination are marked
  as const tables, but are not present in the Explain data structures
parent c08de062
...@@ -23268,7 +23268,7 @@ void append_possible_keys(String *str, TABLE *table, key_map possible_keys) ...@@ -23268,7 +23268,7 @@ void append_possible_keys(String *str, TABLE *table, key_map possible_keys)
// join tab. // join tab.
void JOIN_TAB::update_explain_data(uint idx) void JOIN_TAB::update_explain_data(uint idx)
{ {
if (this == first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS) && if (this == first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS) + join->const_tables &&
join->select_lex->select_number != INT_MAX && join->select_lex->select_number != INT_MAX &&
join->select_lex->select_number != UINT_MAX) join->select_lex->select_number != UINT_MAX)
{ {
...@@ -23277,6 +23277,7 @@ void JOIN_TAB::update_explain_data(uint idx) ...@@ -23277,6 +23277,7 @@ void JOIN_TAB::update_explain_data(uint idx)
save_explain_data(eta, join->const_table_map, join->select_distinct, first_top_tab); save_explain_data(eta, join->const_table_map, join->select_distinct, first_top_tab);
Explain_select *sel= join->thd->lex->explain->get_select(join->select_lex->select_number); Explain_select *sel= join->thd->lex->explain->get_select(join->select_lex->select_number);
idx -= my_count_bits(join->eliminated_tables);
sel->replace_table(idx, eta); sel->replace_table(idx, eta);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment