diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_subselect.cc | 8 | ||||
-rw-r--r-- | sql/sql_select.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.h | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 6683b6f39e8..a07d444b222 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2655,9 +2655,11 @@ bool setup_sj_materialization(JOIN_TAB *tab) then substitute_for_best_equal_field() will change the conditions according to the join order: - it1 - it2 it1.col=it2.col - ot cond(it1.col) + table | attached condition + ------+-------------------- + it1 | + it2 | it1.col=it2.col + ot | cond(it1.col) although we've originally had "SELECT it2.col", conditions attached to subsequent outer tables will refer to it1.col, so SJM-Scan will diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 39f0798f8b2..d206fac129f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2971,7 +2971,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, join->join_tab=stat; join->map2table=stat_ref; - join->table= join->all_tables=table_vector; + join->table= table_vector; join->const_tables=const_count; join->found_const_table_map=found_const_table_map; @@ -4132,7 +4132,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array) for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ; 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); } } diff --git a/sql/sql_select.h b/sql/sql_select.h index ab62f5f7d46..36ab753a6ae 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1373,8 +1373,11 @@ public: JOIN_TAB *join_tab,**best_ref; JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs 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 **all_tables; /** 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 |