Skip to content

Commit c826b6b

Browse files
committed
Added a new parameter for the function eq_ranges_exceeds_limit()
introduced in the patch fo MDEV-16934.
1 parent 8b949d9 commit c826b6b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

sql/multi_range_read.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
6464
ha_rows rows, total_rows= 0;
6565
uint n_ranges=0;
6666
THD *thd= table->in_use;
67+
uint limit= thd->variables.eq_range_index_dive_limit;
6768

69+
bool use_statistics_for_eq_range= eq_ranges_exceeds_limit(seq,
70+
seq_init_param,
71+
limit);
72+
6873
/* Default MRR implementation doesn't need buffer */
6974
*bufsz= 0;
7075

71-
bool use_statistics_for_eq_range= eq_ranges_exceeds_limit(seq,
72-
seq_init_param);
73-
7476
seq_it= seq->init(seq_init_param, n_ranges, *flags);
7577
while (!seq->next(seq_it, &range))
7678
{

sql/opt_range.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14619,13 +14619,12 @@ void QUICK_GROUP_MIN_MAX_SELECT::add_keys_and_lengths(String *key_names,
1461914619

1462014620
/* Check whether the number for equality ranges exceeds the set threshold */
1462114621

14622-
bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param)
14622+
bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param,
14623+
uint limit)
1462314624
{
1462414625
KEY_MULTI_RANGE range;
1462514626
range_seq_t seq_it;
1462614627
uint count = 0;
14627-
PARAM *param= ((SEL_ARG_RANGE_SEQ*) seq_init_param)->param;
14628-
uint limit= param->thd->variables.eq_range_index_dive_limit;
1462914628

1463014629
if (limit == 0)
1463114630
{

sql/opt_range.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,8 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
16641664

16651665
bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond);
16661666

1667-
bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param);
1667+
bool eq_ranges_exceeds_limit(RANGE_SEQ_IF *seq, void *seq_init_param,
1668+
uint limit);
16681669

16691670
#ifdef WITH_PARTITION_STORAGE_ENGINE
16701671
bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond);

0 commit comments

Comments
 (0)