diff options
author | unknown <tsmith/tim@siva.hindu.god> | 2006-10-24 14:42:08 -0600 |
---|---|---|
committer | unknown <tsmith/tim@siva.hindu.god> | 2006-10-24 14:42:08 -0600 |
commit | d4bfae38ac685d1f277fcc1b42ac003f98d8c940 (patch) | |
tree | f6b3ce247f0c1b8d045348dca4533d282d470935 /sql/opt_range.cc | |
parent | 752e5f1ec77f79009804a6ed316843b184b46394 (diff) | |
parent | 69c7200219dd2010de7ca33d89432aff4fbd9e3a (diff) | |
download | mariadb-git-d4bfae38ac685d1f277fcc1b42ac003f98d8c940.tar.gz |
Merge siva.hindu.god:/usr/home/tim/m/bk/g50
into siva.hindu.god:/usr/home/tim/m/bk/50
configure.in:
Auto merged
mysql-test/r/rename.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/view.test:
Auto merged
mysys/mf_iocache.c:
Auto merged
sql/item_func.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/opt_range.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/table.cc:
Auto merged
myisam/sort.c:
Manual merge
mysql-test/r/innodb_mysql.result:
Manual merge
mysql-test/t/innodb_mysql.test:
Manual merge
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 c936663cdfc..96239315026 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8376,6 +8376,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); } @@ -8606,6 +8607,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. |