summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-09-11 21:31:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-09-11 21:31:03 +0300
commit1bf3e8ab43e982953d7534db902020d321364afb (patch)
tree7de4aaac9f947d4302cd4edbb5677da8917ade71 /sql/opt_range.cc
parentf5bebaf1d6a0ff2fca9b342ed5910b9d34a276bb (diff)
parent4901f31c13f91e130f077f2f77b32c40b0036e32 (diff)
downloadmariadb-git-1bf3e8ab43e982953d7534db902020d321364afb.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 107c0d8ed89..7faae008dab 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -14829,6 +14829,32 @@ 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,
+ uint limit)
+{
+ KEY_MULTI_RANGE range;
+ range_seq_t seq_it;
+ uint count = 0;
+
+ if (limit == 0)
+ {
+ /* 'Statistics instead of index dives' feature is turned off */
+ return false;
+ }
+ seq_it= seq->init(seq_init_param, 0, 0);
+ while (!seq->next(seq_it, &range))
+ {
+ if ((range.range_flag & EQ_RANGE) && !(range.range_flag & NULL_RANGE))
+ {
+ if (++count >= limit)
+ return true;
+ }
+ }
+ return false;
+}
+
#ifndef DBUG_OFF
static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,