diff options
author | unknown <gkodinov/kgeorge@rakia.(none)> | 2006-10-16 19:46:02 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@rakia.(none)> | 2006-10-16 19:46:02 +0300 |
commit | 6caacb9bbd1dc53e34ce338d85fbba7b95c798f9 (patch) | |
tree | 1c68ee3c0632fac99112ee091e2f619eb0be39e1 /sql/opt_range.cc | |
parent | 40197cd33f7695acd32f75b1d2a5f259f9f12ec5 (diff) | |
parent | decf9082fbc170e34d896598217b8113b06634cb (diff) | |
download | mariadb-git-6caacb9bbd1dc53e34ce338d85fbba7b95c798f9.tar.gz |
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.(none):/home/kgeorge/mysql/autopush/B22342-5.0-opt
sql/opt_range.cc:
Auto merged
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 79cfbc72fe7..eb7d627de96 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8371,6 +8371,7 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *param, bool retrieve_full_rows, quick->quick_prefix_select= NULL; quick->update_key_stat(); + quick->adjust_prefix_ranges(); DBUG_RETURN(quick); } @@ -8601,6 +8602,42 @@ bool QUICK_GROUP_MIN_MAX_SELECT::add_range(SEL_ARG *sel_range) /* + Opens the ranges if there are more conditions in quick_prefix_select than + the ones used for jumping through the prefixes. + + SYNOPSIS + QUICK_GROUP_MIN_MAX_SELECT::adjust_prefix_ranges() + + NOTES + quick_prefix_select is made over the conditions on the whole key. + It defines a number of ranges of length x. + However when jumping through the prefixes we use only the the first + few most significant keyparts in the range key. However if there + are more keyparts to follow the ones we are using we must make the + condition on the key inclusive (because x < "ab" means + x[0] < 'a' OR (x[0] == 'a' AND x[1] < 'b'). + To achive the above we must turn off the NEAR_MIN/NEAR_MAX +*/ +void QUICK_GROUP_MIN_MAX_SELECT::adjust_prefix_ranges () +{ + if (quick_prefix_select && + group_prefix_len < quick_prefix_select->max_used_key_length) + { + DYNAMIC_ARRAY *arr; + uint inx; + + for (inx= 0, arr= &quick_prefix_select->ranges; inx < arr->elements; inx++) + { + QUICK_RANGE *range; + + get_dynamic(arr, (gptr)&range, inx); + range->flag &= ~(NEAR_MIN | NEAR_MAX); + } + } +} + + +/* Determine the total number and length of the keys that will be used for index lookup. |