diff options
author | Igor Babaev <igor@askmonty.org> | 2018-08-24 20:53:00 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-08-24 20:53:00 -0700 |
commit | c826b6b8da3c9ee89ab457155bae96310213e5a1 (patch) | |
tree | 72085f6edd334eb4ba275ecba3c25706fbe5f624 | |
parent | 8b949d961ce46479eb10b6ddb5d91eb7d8bc0f73 (diff) | |
download | mariadb-git-c826b6b8da3c9ee89ab457155bae96310213e5a1.tar.gz |
Added a new parameter for the function eq_ranges_exceeds_limit()
introduced in the patch fo MDEV-16934.
-rw-r--r-- | sql/multi_range_read.cc | 8 | ||||
-rw-r--r-- | sql/opt_range.cc | 5 | ||||
-rw-r--r-- | sql/opt_range.h | 3 |
3 files changed, 9 insertions, 7 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 94a96c27a0f..9b6d0e86f90 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -64,13 +64,15 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, ha_rows rows, total_rows= 0; uint n_ranges=0; THD *thd= table->in_use; + uint limit= thd->variables.eq_range_index_dive_limit; + bool use_statistics_for_eq_range= eq_ranges_exceeds_limit(seq, + seq_init_param, + limit); + /* Default MRR implementation doesn't need buffer */ *bufsz= 0; - bool use_statistics_for_eq_range= eq_ranges_exceeds_limit(seq, - seq_init_param); - seq_it= seq->init(seq_init_param, n_ranges, *flags); while (!seq->next(seq_it, &range)) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 47e07016782..2c015c1a5da 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -14619,13 +14619,12 @@ void QUICK_GROUP_MIN_MAX_SELECT::add_keys_and_lengths(String *key_names, /* Check whether the number for equality ranges exceeds the set threshold */ -bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param) +bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param, + uint limit) { KEY_MULTI_RANGE range; range_seq_t seq_it; uint count = 0; - PARAM *param= ((SEL_ARG_RANGE_SEQ*) seq_init_param)->param; - uint limit= param->thd->variables.eq_range_index_dive_limit; if (limit == 0) { diff --git a/sql/opt_range.h b/sql/opt_range.h index 6698c987e78..9e0bd3ae9ff 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1664,7 +1664,8 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond); -bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param); +bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param, + uint limit); #ifdef WITH_PARTITION_STORAGE_ENGINE bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); |