diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-05-04 07:16:38 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-05-04 07:16:38 +0200 |
commit | 44cf9ee5f7acd2148dc32f4eee4519a087c52b93 (patch) | |
tree | 5b67e89f11e9cdac90d6cc13655e61a55400addd /sql/opt_subselect.cc | |
parent | 550d6871a5eb93013435055e11a4fe3009490c82 (diff) | |
parent | d335b471918b4ab0bca05984a70669653cf3169f (diff) | |
download | mariadb-git-44cf9ee5f7acd2148dc32f4eee4519a087c52b93.tar.gz |
5.3 merge
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 56b76f5982e..9bf1aaf4039 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -5467,8 +5467,8 @@ bool JOIN::choose_tableless_subquery_plan() /* If the optimizer determined that his query has an empty result, in most cases the subquery predicate is a known constant value - - either FALSE or NULL. The implementation of Item_subselect::reset() - determines which one. + either of TRUE, FALSE or NULL. The implementation of + Item_subselect::no_rows_in_result() determines which one. */ if (zero_result_cause) { @@ -5476,14 +5476,13 @@ bool JOIN::choose_tableless_subquery_plan() { /* Both group by queries and non-group by queries without aggregate - functions produce empty subquery result. + functions produce empty subquery result. There is no need to further + rewrite the subquery because it will not be executed at all. */ - subs_predicate->reset(); - subs_predicate->make_const(); return FALSE; } - /* TODO: + /* @todo A further optimization is possible when a non-group query with MIN/MAX/COUNT is optimized by opt_sum_query. Then, if there are only MIN/MAX functions over an empty result set, the subquery |