Commit 730eb1c4 authored by Sergei Petrunia's avatar Sergei Petrunia

Code cleanup in/around check_interleaving_with_nj()

- In best_extension_by_limited_search(), do not check for
  "(remaining_tables & real_table_bit)", it is guaranteed to be true.
  Make it an assert.
- In (!idx || check_interleaving_with_nj())", remove the !idx part.
  This check made sense only in the original version of this function.
- "micro optimization" in check_interleaving_with_nj().
parent 8c28b27f
...@@ -8962,10 +8962,11 @@ best_extension_by_limited_search(JOIN *join, ...@@ -8962,10 +8962,11 @@ best_extension_by_limited_search(JOIN *join,
for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++) for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++)
{ {
table_map real_table_bit= s->table->map; table_map real_table_bit= s->table->map;
if ((remaining_tables & real_table_bit) && DBUG_ASSERT(remaining_tables & real_table_bit);
(allowed_tables & real_table_bit) &&
if ((allowed_tables & real_table_bit) &&
!(remaining_tables & s->dependent) && !(remaining_tables & s->dependent) &&
(!idx || !check_interleaving_with_nj(s))) !check_interleaving_with_nj(s))
{ {
double current_record_count, current_read_time; double current_record_count, current_read_time;
POSITION *position= join->positions + idx; POSITION *position= join->positions + idx;
...@@ -16076,7 +16077,6 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list) ...@@ -16076,7 +16077,6 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
static bool check_interleaving_with_nj(JOIN_TAB *next_tab) static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
{ {
TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
JOIN *join= next_tab->join; JOIN *join= next_tab->join;
if (join->cur_embedding_map & ~next_tab->embedding_map) if (join->cur_embedding_map & ~next_tab->embedding_map)
...@@ -16088,6 +16088,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab) ...@@ -16088,6 +16088,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
return TRUE; return TRUE;
} }
TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
/* /*
Do update counters for "pairs of brackets" that we've left (marked as Do update counters for "pairs of brackets" that we've left (marked as
X,Y,Z in the above picture) X,Y,Z in the above picture)
......
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