Commit 6c351cd8 authored by Sergey Petrunya's avatar Sergey Petrunya

More fixes

parent 49568aef
......@@ -1364,7 +1364,7 @@ explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using index
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.61 Using index; FirstMatch(t2)
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`))
insert into t1 values (3,31);
......
......@@ -6060,6 +6060,8 @@ get_best_combination(JOIN *join)
j->quick= NULL;
sjm_nest_end= jt + sjm->tables;
sjm_saved_tab= j;
root_range->end= j+1;
j= jt;
//goto loop_end_not_table;
}
......@@ -6870,7 +6872,9 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (tmp || !cond || tab->type == JT_REF || tab->type == JT_REF_OR_NULL ||
tab->type == JT_EQ_REF || first_inner_tab)
{
DBUG_EXECUTE("where",print_where(tmp,tab->table->alias, QT_ORDINARY););
DBUG_EXECUTE("where",print_where(tmp,
tab->table? tab->table->alias :"sjm-nest",
QT_ORDINARY););
SQL_SELECT *sel= tab->select= ((SQL_SELECT*)
thd->memdup((uchar*) select,
sizeof(*select)));
......@@ -6894,6 +6898,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
tab->set_select_cond(tmp, __LINE__);
/* Push condition to storage engine if this is enabled
and the condition is not guarded */
if (tab->table) //psergey3-todo: how about ICP for bushy plans?
{
tab->table->file->pushed_cond= NULL;
if (thd->variables.engine_condition_pushdown && !first_inner_tab)
{
......@@ -6907,6 +6913,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
}
}
}
else
{
sel->cond= NULL;
......@@ -6914,7 +6921,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
sel->head=tab->table;
DBUG_EXECUTE("where",print_where(tmp,tab->table->alias, QT_ORDINARY););
DBUG_EXECUTE("where",print_where(tmp,tab->table? tab->table->alias: "sjm-nest", QT_ORDINARY););
if (tab->quick)
{
/* Use quick key read if it's a constant and it's not used
......@@ -6933,7 +6940,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
tab->quick=0;
}
uint ref_key=(uint) sel->head->reginfo.join_tab->ref.key+1;
uint ref_key= sel->head? (uint) sel->head->reginfo.join_tab->ref.key+1 : 0;
if (i == join->const_tables && ref_key)
{
if (!tab->const_keys.is_clear_all() &&
......
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