summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-05-27 18:40:37 +0300
committerunknown <monty@narttu.mysql.fi>2003-05-27 18:40:37 +0300
commitef6d3a806085efdc138e6e894a832e4330692e64 (patch)
treebc5052caf5ad47985df6d6862e6380f64e895fb2 /sql/opt_range.cc
parent1540912eca3b2daee03d78e85b39b3d19c192f15 (diff)
downloadmariadb-git-ef6d3a806085efdc138e6e894a832e4330692e64.tar.gz
ORDER BY optimization
Fixed new bug when reading field types client/mysql.cc: Fixed output for -T libmysql/libmysql.c: Filled missing fields in new MYSQL_FIELD structure Fixed new bug when reading field types mysql-test/r/order_by.result: Result after new order by optimization sql/opt_range.cc: New ORDER BY optimization sql/opt_range.h: New ORDER BY optimization sql/set_var.cc: Speed optimization sql/sql_select.cc: New ORDER BY optimization This alllows MySQL to change a ref/range index from (a,b) to (a,c) when 'b' was not used to find rows and one did ORDER BY a,c or ORDER BY c
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index d40f2e22ea2..6c1c49e23fc 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -379,8 +379,8 @@ SQL_SELECT::~SQL_SELECT()
#undef index // Fix for Unixware 7
QUICK_SELECT::QUICK_SELECT(TABLE *table,uint key_nr,bool no_alloc)
- :dont_free(0),error(0),index(key_nr),max_used_key_length(0),head(table),
- it(ranges),range(0)
+ :dont_free(0),error(0),index(key_nr),max_used_key_length(0),
+ used_key_parts(0), head(table), it(ranges),range(0)
{
if (!no_alloc)
{
@@ -2326,6 +2326,7 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key,
flag);
set_if_bigger(quick->max_used_key_length,range->min_length);
set_if_bigger(quick->max_used_key_length,range->max_length);
+ set_if_bigger(quick->used_key_parts, (uint) key_tree->part+1);
if (!range) // Not enough memory
return 1;
quick->ranges.push_back(range);