Commit 76fd8c1c authored by Sergey Petrunya's avatar Sergey Petrunya

Change "disable semi-joins in presense of outer joins" check to actually

check for outer joins (and not for any "t1 SOME_JOIN t2 ON cond" syntax).
parent 524e6aad
...@@ -601,6 +601,26 @@ bool make_in_exists_conversion(THD *thd, JOIN *join, Item_in_subselect *item) ...@@ -601,6 +601,26 @@ bool make_in_exists_conversion(THD *thd, JOIN *join, Item_in_subselect *item)
} }
bool check_for_outer_joins(List<TABLE_LIST> *join_list)
{
TABLE_LIST *table;
NESTED_JOIN *nested_join;
List_iterator<TABLE_LIST> li(*join_list);
while ((table= li++))
{
if ((nested_join= table->nested_join))
{
if (check_for_outer_joins(&nested_join->join_list))
return TRUE;
}
if (table->outer_join)
return TRUE;
}
return FALSE;
}
/* /*
Convert semi-join subquery predicates into semi-join join nests Convert semi-join subquery predicates into semi-join join nests
...@@ -685,6 +705,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join) ...@@ -685,6 +705,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
// Temporary measure: disable semi-joins when they are together with outer // Temporary measure: disable semi-joins when they are together with outer
// joins. // joins.
/*
for (TABLE_LIST *tbl= join->select_lex->leaf_tables; tbl; tbl=tbl->next_leaf) for (TABLE_LIST *tbl= join->select_lex->leaf_tables; tbl; tbl=tbl->next_leaf)
{ {
TABLE_LIST *embedding= tbl->embedding; TABLE_LIST *embedding= tbl->embedding;
...@@ -695,6 +716,12 @@ bool convert_join_subqueries_to_semijoins(JOIN *join) ...@@ -695,6 +716,12 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
arena= thd->activate_stmt_arena_if_needed(&backup); arena= thd->activate_stmt_arena_if_needed(&backup);
goto skip_conversion; goto skip_conversion;
} }
}*/
if (check_for_outer_joins(join->join_list))
{
in_subq= join->sj_subselects.front();
arena= thd->activate_stmt_arena_if_needed(&backup);
goto skip_conversion;
} }
//dump_TABLE_LIST_struct(select_lex, select_lex->leaf_tables); //dump_TABLE_LIST_struct(select_lex, select_lex->leaf_tables);
......
...@@ -701,7 +701,8 @@ public: ...@@ -701,7 +701,8 @@ public:
/* Tables removed by table elimination. Set to 0 before the elimination. */ /* Tables removed by table elimination. Set to 0 before the elimination. */
table_map eliminated_tables; table_map eliminated_tables;
/* /*
Bitmap of all inner tables from outer joins Bitmap of all inner tables from outer joins (set at start of
make_join_statistics)
*/ */
table_map outer_join; table_map outer_join;
ha_rows send_records,found_records,examined_rows,row_limit, select_limit; ha_rows send_records,found_records,examined_rows,row_limit, select_limit;
......
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