Commit 687a51f8 authored by Sergei Petrunia's avatar Sergei Petrunia

Forgot to add sql_select.cc to the previous commit

parent 970307f5
...@@ -7304,13 +7304,13 @@ double JOIN::get_examined_rows() ...@@ -7304,13 +7304,13 @@ double JOIN::get_examined_rows()
{ {
double examined_rows; double examined_rows;
double prev_fanout= 1; double prev_fanout= 1;
JOIN_TAB *tab= first_breadth_first_optimization_tab(); JOIN_TAB *tab= first_breadth_first_tab();
JOIN_TAB *prev_tab= tab; JOIN_TAB *prev_tab= tab;
examined_rows= tab->get_examined_rows(); examined_rows= tab->get_examined_rows();
while ((tab= next_breadth_first_tab(first_breadth_first_optimization_tab(), while ((tab= next_breadth_first_tab(first_breadth_first_tab(),
top_table_access_tabs_count, tab))) top_join_tab_count, tab)))
{ {
prev_fanout *= prev_tab->records_read; prev_fanout *= prev_tab->records_read;
examined_rows+= tab->get_examined_rows() * prev_fanout; examined_rows+= tab->get_examined_rows() * prev_fanout;
...@@ -8262,7 +8262,7 @@ static JOIN_TAB *next_breadth_first_tab(JOIN_TAB *first_top_tab, ...@@ -8262,7 +8262,7 @@ static JOIN_TAB *next_breadth_first_tab(JOIN_TAB *first_top_tab,
JOIN_TAB *first_explain_order_tab(JOIN* join) JOIN_TAB *first_explain_order_tab(JOIN* join)
{ {
JOIN_TAB* tab; JOIN_TAB* tab;
tab= join->table_access_tabs; tab= join->join_tab;
return (tab->bush_children) ? tab->bush_children->start : tab; return (tab->bush_children) ? tab->bush_children->start : tab;
} }
...@@ -8276,7 +8276,7 @@ JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab) ...@@ -8276,7 +8276,7 @@ JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab)
/* Move to next tab in the array we're traversing */ /* Move to next tab in the array we're traversing */
tab++; tab++;
if (tab == join->table_access_tabs + join->top_join_tab_count) if (tab == join->join_tab + join->top_join_tab_count)
return NULL; /* Outside SJM nest and reached EOF */ return NULL; /* Outside SJM nest and reached EOF */
if (tab->bush_children) if (tab->bush_children)
...@@ -8302,7 +8302,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls ...@@ -8302,7 +8302,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
JOIN_TAB *next_top_level_tab(JOIN *join, JOIN_TAB *tab) JOIN_TAB *next_top_level_tab(JOIN *join, JOIN_TAB *tab)
{ {
tab= next_breadth_first_tab(join->first_breadth_first_execution_tab(), tab= next_breadth_first_tab(join->first_breadth_first_tab(),
join->top_join_tab_count, tab); join->top_join_tab_count, tab);
if (tab && tab->bush_root_tab) if (tab && tab->bush_root_tab)
tab= NULL; tab= NULL;
...@@ -8636,12 +8636,6 @@ bool JOIN::get_best_combination() ...@@ -8636,12 +8636,6 @@ bool JOIN::get_best_combination()
top_join_tab_count= join_tab_ranges.head()->end - top_join_tab_count= join_tab_ranges.head()->end -
join_tab_ranges.head()->start; join_tab_ranges.head()->start;
/*
Save pointers to select join tabs for SHOW EXPLAIN
*/
table_access_tabs= join_tab;
top_table_access_tabs_count= top_join_tab_count;
update_depend_map(this); update_depend_map(this);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -11754,20 +11748,10 @@ void JOIN::cleanup(bool full) ...@@ -11754,20 +11748,10 @@ void JOIN::cleanup(bool full)
*/ */
if (table_count) if (table_count)
{ {
for (tab= first_breadth_first_optimization_tab(); tab; for (tab= first_breadth_first_tab(); tab;
tab= next_breadth_first_tab(first_breadth_first_optimization_tab(), tab= next_breadth_first_tab(first_breadth_first_tab(),
top_table_access_tabs_count, tab)) top_join_tab_count, tab))
tab->cleanup(); tab->cleanup();
/* We've walked optimization tabs, do execution ones too. */
if (first_breadth_first_execution_tab() !=
first_breadth_first_optimization_tab())
{
for (tab= first_breadth_first_execution_tab(); tab;
tab= next_breadth_first_tab(first_breadth_first_execution_tab(),
top_join_tab_count, tab))
tab->cleanup();
}
} }
cleaned= true; cleaned= true;
//psergey2: added (Q: why not in the above loop?) //psergey2: added (Q: why not in the above loop?)
...@@ -24163,7 +24147,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table, ...@@ -24163,7 +24147,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
xpl_sel->having= having; xpl_sel->having= having;
xpl_sel->having_value= having_value; xpl_sel->having_value= having_value;
JOIN_TAB* const first_top_tab= join->first_breadth_first_optimization_tab(); JOIN_TAB* const first_top_tab= join->first_breadth_first_tab();
JOIN_TAB* prev_bush_root_tab= NULL; JOIN_TAB* prev_bush_root_tab= NULL;
Explain_basic_join *cur_parent= xpl_sel; Explain_basic_join *cur_parent= xpl_sel;
......
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