summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-05-30 20:56:11 +0400
committerunknown <konstantin@mysql.com>2005-05-30 20:56:11 +0400
commit7878189d39af6fd22a7cc06a2a9de8d81b1adaf8 (patch)
tree4ed95e1092af1922457a7c10ddee5b8e88ecc9e8 /sql/opt_range.cc
parent2dc4e0485cee5fd139162b01514953832b81557d (diff)
parenta127820ae1602c9b119cc3b7528faedcb8223488 (diff)
downloadmariadb-git-7878189d39af6fd22a7cc06a2a9de8d81b1adaf8.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/opt/local/work/mysql-5.0-7306-new sql/item_subselect.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_olap.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5718ab5e010..c250238eb4b 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7980,8 +7980,17 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
}
}
}
- else if (have_min && min_max_arg_part && min_max_arg_part->field->is_null())
+ else if (have_min && min_max_arg_part &&
+ min_max_arg_part->field->real_maybe_null())
{
+ /*
+ If a MIN/MAX argument value is NULL, we can quickly determine
+ that we're in the beginning of the next group, because NULLs
+ are always < any other value. This allows us to quickly
+ determine the end of the current group and jump to the next
+ group (see next_min()) and thus effectively increases the
+ usable key length.
+ */
max_used_key_length+= min_max_arg_len;
++used_key_parts;
}