diff options
author | unknown <igor@olga.mysql.com> | 2007-02-02 15:22:10 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-02-02 15:22:10 -0800 |
commit | 8cea541c418b5264db883131baec5151b07cc31a (patch) | |
tree | c43db5c7b276574cabf4a5f8e38755f9d43e60e7 /sql/opt_range.cc | |
parent | 4e8d7ac4222452c60b7d0265fdaef2fa38d278bc (diff) | |
download | mariadb-git-8cea541c418b5264db883131baec5151b07cc31a.tar.gz |
Fix bug #24035.
This performance degradation for UPDATEs could be observed in the update
statements for which the search key cannot be converted to any valid
value of the type of the search column, like for a the condition
int_fld=99999999999999999999999999, though it can be guaranteed here
that there is no row with such a key value.
mysql-test/r/update.result:
Added a test case for bug #24035.
mysql-test/t/update.test:
Added a test case for bug #24035.
sql/opt_range.cc:
Fix bug #24035.
This performance degradation for could be observed in the update
statements for which the search key cannot be converted to any valid
value of the type of the search column, like for a the condition
int_fld=99999999999999999999999999, though it can be guaranteed here
that there is no row with such a key value.
Now the function get_mm_leaf creates trees of the type SEL_ARG::IMPOSSIBLE
for such conditions that tells the range scan not to perform any search
at all.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f0af4b7db2a..744d222b833 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -4296,7 +4296,22 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part, err= value->save_in_field_no_warnings(field, 1); if (err > 0 && field->cmp_type() != value->result_type()) { - tree= 0; + if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) && + value->result_type() == item_cmp_type(field->result_type(), + value->result_type())) + + { + tree= new (alloc) SEL_ARG(field, 0, 0); + tree->type= SEL_ARG::IMPOSSIBLE; + } + else + { + /* + TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE + for the cases like int_field > 999999999999999999999999 as well. + */ + tree= 0; + } goto end; } if (err < 0) |