Commit a9bee333 authored by Sergey Petrunya's avatar Sergey Petrunya

MWL#90: Subqueries: Inside-out execution for non-semijoin materialized...

MWL#90: Subqueries: Inside-out execution for non-semijoin materialized subqueries that are AND-parts of the WHERE
- Remove JOIN::all_tables as it is not useful.
- Better wording in comments
parent 69ce61f6
...@@ -2655,9 +2655,11 @@ bool setup_sj_materialization(JOIN_TAB *tab) ...@@ -2655,9 +2655,11 @@ bool setup_sj_materialization(JOIN_TAB *tab)
then substitute_for_best_equal_field() will change the conditions then substitute_for_best_equal_field() will change the conditions
according to the join order: according to the join order:
it1 table | attached condition
it2 it1.col=it2.col ------+--------------------
ot cond(it1.col) it1 |
it2 | it1.col=it2.col
ot | cond(it1.col)
although we've originally had "SELECT it2.col", conditions attached although we've originally had "SELECT it2.col", conditions attached
to subsequent outer tables will refer to it1.col, so SJM-Scan will to subsequent outer tables will refer to it1.col, so SJM-Scan will
......
...@@ -2971,7 +2971,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, ...@@ -2971,7 +2971,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
join->join_tab=stat; join->join_tab=stat;
join->map2table=stat_ref; join->map2table=stat_ref;
join->table= join->all_tables=table_vector; join->table= table_vector;
join->const_tables=const_count; join->const_tables=const_count;
join->found_const_table_map=found_const_table_map; join->found_const_table_map=found_const_table_map;
...@@ -4132,7 +4132,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array) ...@@ -4132,7 +4132,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ; for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ;
if (map == 1) // Only one table if (map == 1) // Only one table
{ {
TABLE *tmp_table=join->all_tables[tablenr]; TABLE *tmp_table=join->table[tablenr];
keyuse->ref_table_rows= max(tmp_table->file->stats.records, 100); keyuse->ref_table_rows= max(tmp_table->file->stats.records, 100);
} }
} }
......
...@@ -1373,8 +1373,11 @@ class JOIN :public Sql_alloc ...@@ -1373,8 +1373,11 @@ class JOIN :public Sql_alloc
JOIN_TAB *join_tab,**best_ref; JOIN_TAB *join_tab,**best_ref;
JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs
JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution
/*
Base tables participating in the join. After join optimization is done, the
tables are stored in the join order.
*/
TABLE **table; TABLE **table;
TABLE **all_tables;
/** /**
The table which has an index that allows to produce the requried ordering. The table which has an index that allows to produce the requried ordering.
A special value of 0x1 means that the ordering will be produced by A special value of 0x1 means that the ordering will be produced by
......
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