Commit 74bb936d authored by Sergey Petrunya's avatar Sergey Petrunya

optimize_wo_join_buffering(): Put saving/restoring of cur_sj_inner_tables back,

  together with explanation why we need it.
parent c763fb1b
......@@ -11542,6 +11542,20 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
for (i= first_tab; i <= last_tab; i++)
reopt_remaining_tables |= join->positions[i].table->table->map;
/*
best_access_path() optimization depends on the value of
join->cur_sj_inner_tables. Our goal in this function is to do a
re-optimization with disabled join buffering, but no other changes.
In order to achieve this, cur_sj_inner_tables needs have the same
value it had during the original invocations of best_access_path.
We know that this function, optimize_wo_join_buffering() is called to
re-optimize semi-join join order range, which allows to conclude that
the "original" value of cur_sj_inner_tables was 0.
*/
table_map save_cur_sj_inner_tables= join->cur_sj_inner_tables;
join->cur_sj_inner_tables= 0;
for (i= first_tab; i <= last_tab; i++)
{
JOIN_TAB *rs= join->positions[i].table;
......@@ -11567,6 +11581,7 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
if (!rs->emb_sj_nest)
*outer_rec_count *= pos.records_read;
}
join->cur_sj_inner_tables= save_cur_sj_inner_tables;
*reopt_cost= cost;
}
......
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