Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created January 28, 2013 07:26
Show Gist options
  • Save spetrunia/4653654 to your computer and use it in GitHub Desktop.
Save spetrunia/4653654 to your computer and use it in GitHub Desktop.
=== modified file 'sql/opt_subselect.cc'
--- sql/opt_subselect.cc 2013-01-07 19:21:05 +0000
+++ sql/opt_subselect.cc 2013-01-28 07:25:49 +0000
@@ -2542,6 +2542,12 @@ void advance_sj_state(JOIN *join, table_
/* Mark strategy as used */
(*strategy)->mark_used();
pos->sj_strategy= sj_strategy;
+
+ if (sj_strategy= SJ_OPT_MATERIALIZE)
+ join->sj_materialized_lookup_tables |= handled_fanout;
+ else
+ join->sj_materialized_lookup_tables &= ~handled_fanout;
+
*current_read_time= read_time;
*current_record_count= rec_count;
join->cur_dups_producing_tables &= ~handled_fanout;
@@ -3073,6 +3079,7 @@ void restore_prev_sj_state(const table_m
(emb_sj_nest->sj_inner_tables & ~tab->table->map))
{
tab->join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables;
+ join->sj_materialized_lookup_tables &= ~emb_sj_nest->sj_inner_tables;
}
}
POSITION *pos= tab->join->positions + idx;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment