summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <sergey@mariadb.com>2022-05-14 20:19:05 +0300
committerSergei Petrunia <sergey@mariadb.com>2022-05-15 11:10:36 +0300
commit730eb1c4be84b7f06dc8d4a894536941cbe5da63 (patch)
tree32d0d3eab6b6202cdbf2ec0eaa0eb6d85b75fb31
parent8c28b27f00941b2886f691010f822fe506b15af7 (diff)
downloadmariadb-git-730eb1c4be84b7f06dc8d4a894536941cbe5da63.tar.gz
Code cleanup in/around check_interleaving_with_nj()bb-10.3-spetrunia
- 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().
-rw-r--r--sql/sql_select.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6d8d389b81d..ee834f5d806 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8962,10 +8962,11 @@ best_extension_by_limited_search(JOIN *join,
for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++)
{
table_map real_table_bit= s->table->map;
- if ((remaining_tables & real_table_bit) &&
- (allowed_tables & real_table_bit) &&
+ DBUG_ASSERT(remaining_tables & real_table_bit);
+
+ if ((allowed_tables & real_table_bit) &&
!(remaining_tables & s->dependent) &&
- (!idx || !check_interleaving_with_nj(s)))
+ !check_interleaving_with_nj(s))
{
double current_record_count, current_read_time;
POSITION *position= join->positions + idx;
@@ -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)
{
- TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
JOIN *join= next_tab->join;
if (join->cur_embedding_map & ~next_tab->embedding_map)
@@ -16088,6 +16088,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
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
X,Y,Z in the above picture)