3094
3094
(*in_subq)->sj_convert_priority=
3095
3095
(*in_subq)->is_correlated * MAX_TABLES + child_join->outer_tables;
3098
bool outer_join_disable_semi_join= false;
3099
2. Pick which subqueries to convert:
3100
sort the subquery array
3101
- prefer correlated subqueries over uncorrelated;
3102
- prefer subqueries that have greater number of outer tables;
3104
sj_subselects.sort(subq_sj_candidate_cmp);
3105
// #tables-in-parent-query + #tables-in-subquery < MAX_TABLES
3106
/* Replace all subqueries to be flattened with Item_int(1) */
3107
for (in_subq= sj_subselects.front();
3108
in_subq != in_subq_end &&
3109
tables + ((*in_subq)->sj_convert_priority % MAX_TABLES) < MAX_TABLES;
3100
* Temporary measure: disable semi-joins when they are together with outer
3103
* @see LP Bug #314911
3105
for (TableList *tbl= select_lex->leaf_tables; tbl; tbl=tbl->next_leaf)
3112
if (replace_where_subcondition(this, *in_subq, new Item_int(1), false))
3107
TableList *embedding= tbl->embedding;
3108
if (tbl->on_expr || (tbl->embedding && !(embedding->sj_on_expr &&
3109
!embedding->embedding)))
3111
in_subq= sj_subselects.front();
3112
outer_join_disable_semi_join= true;
3116
for (in_subq= sj_subselects.front();
3117
in_subq != in_subq_end &&
3118
tables + ((*in_subq)->sj_convert_priority % MAX_TABLES) < MAX_TABLES;
3116
if (! outer_join_disable_semi_join)
3121
if (convert_subq_to_sj(this, *in_subq))
3119
2. Pick which subqueries to convert:
3120
sort the subquery array
3121
- prefer correlated subqueries over uncorrelated;
3122
- prefer subqueries that have greater number of outer tables;
3124
sj_subselects.sort(subq_sj_candidate_cmp);
3125
// #tables-in-parent-query + #tables-in-subquery < MAX_TABLES
3126
/* Replace all subqueries to be flattened with Item_int(1) */
3127
for (in_subq= sj_subselects.front();
3128
in_subq != in_subq_end &&
3129
tables + ((*in_subq)->sj_convert_priority % MAX_TABLES) < MAX_TABLES;
3132
if (replace_where_subcondition(this, *in_subq, new Item_int(1), false))
3136
for (in_subq= sj_subselects.front();
3137
in_subq != in_subq_end &&
3138
tables + ((*in_subq)->sj_convert_priority % MAX_TABLES) < MAX_TABLES;
3141
if (convert_subq_to_sj(this, *in_subq))
3125
3146
/* 3. Finalize those we didn't convert */