Commit c2206d6f authored by Sergey Petrunya's avatar Sergey Petrunya

Subquery optimizations: Backport into 5.3:

- Enable semi-join handling in the join cache code
parent 6ae33523
...@@ -354,7 +354,6 @@ void JOIN_CACHE:: create_remaining_fields(bool all_read_fields) ...@@ -354,7 +354,6 @@ void JOIN_CACHE:: create_remaining_fields(bool all_read_fields)
&copy_ptr); &copy_ptr);
/* SemiJoinDuplicateElimination: allocate space for rowid if needed */ /* SemiJoinDuplicateElimination: allocate space for rowid if needed */
/* !!! NB igor: Enable the code in the comment after backporting the SJ code
if (tab->keep_current_rowid) if (tab->keep_current_rowid)
{ {
copy->str= table->file->ref; copy->str= table->file->ref;
...@@ -366,7 +365,6 @@ void JOIN_CACHE:: create_remaining_fields(bool all_read_fields) ...@@ -366,7 +365,6 @@ void JOIN_CACHE:: create_remaining_fields(bool all_read_fields)
data_field_count++; data_field_count++;
copy++; copy++;
} }
*/
} }
} }
...@@ -1778,10 +1776,8 @@ enum_nested_loop_state JOIN_CACHE_BNL::join_matching_records(bool skip_last) ...@@ -1778,10 +1776,8 @@ enum_nested_loop_state JOIN_CACHE_BNL::join_matching_records(bool skip_last)
info= &join_tab->read_record; info= &join_tab->read_record;
do do
{ {
/* !!! NB igor: Enable the code in the comment after backporting the SJ code
if (join_tab->keep_current_rowid) if (join_tab->keep_current_rowid)
join_tab->table->file->position(join_tab->table->record[0]); join_tab->table->file->position(join_tab->table->record[0]);
*/
if (join->thd->killed) if (join->thd->killed)
{ {
...@@ -1913,10 +1909,9 @@ enum_nested_loop_state JOIN_CACHE::generate_full_extensions(uchar *rec_ptr) ...@@ -1913,10 +1909,9 @@ enum_nested_loop_state JOIN_CACHE::generate_full_extensions(uchar *rec_ptr)
if (check_match(rec_ptr)) if (check_match(rec_ptr))
{ {
int res= 0; int res= 0;
/* !!! NB igor: Enable the code in the comment after backporting the SJ code
if (!join_tab->check_weed_out_table || if (!join_tab->check_weed_out_table ||
!(res= do_sj_dups_weedout(join->thd, join_tab->check_weed_out_table))) !(res= do_sj_dups_weedout(join->thd, join_tab->check_weed_out_table)))
*/
{ {
set_curr_rec_link(rec_ptr); set_curr_rec_link(rec_ptr);
rc= (join_tab->next_select)(join, join_tab+1, 0); rc= (join_tab->next_select)(join, join_tab+1, 0);
...@@ -2291,10 +2286,8 @@ enum_nested_loop_state JOIN_CACHE_BKA::join_matching_records(bool skip_last) ...@@ -2291,10 +2286,8 @@ enum_nested_loop_state JOIN_CACHE_BKA::join_matching_records(bool skip_last)
rc= NESTED_LOOP_KILLED; rc= NESTED_LOOP_KILLED;
goto finish; goto finish;
} }
/* !!!NB igor: Enable the statement in the comment after backporting the SJ code
if (join_tab->keep_current_rowid) if (join_tab->keep_current_rowid)
join_tab->table->file->position(join_tab->table->record[0]); join_tab->table->file->position(join_tab->table->record[0]);
*/
/* /*
If only the first match is needed and it has been already found If only the first match is needed and it has been already found
for the associated partial join record then the returned candidate for the associated partial join record then the returned candidate
......
...@@ -1197,6 +1197,7 @@ enum_nested_loop_state sub_select(JOIN *join,JOIN_TAB *join_tab, bool ...@@ -1197,6 +1197,7 @@ enum_nested_loop_state sub_select(JOIN *join,JOIN_TAB *join_tab, bool
end_of_records); end_of_records);
enum_nested_loop_state sub_select_sjm(JOIN *join, JOIN_TAB *join_tab, enum_nested_loop_state sub_select_sjm(JOIN *join, JOIN_TAB *join_tab,
bool end_of_records); bool end_of_records);
int do_sj_dups_weedout(THD *thd, SJ_TMP_TABLE *sjtbl);
/** /**
Information about a position of table within a join order. Used in join Information about a position of table within a join order. Used in join
......
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