summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <evgen@sunlight.local>2006-07-29 23:59:53 +0400
committerunknown <evgen@sunlight.local>2006-07-29 23:59:53 +0400
commit08be4e96a953a883240e9eebb38a9e8b965d3b1d (patch)
tree4f4d9327b2482d563e3733ac9d995fd0b7f9155e /sql/sql_select.cc
parent667c73be65bc1c1a6f77d6e2bb140cdddae9ec73 (diff)
parent9c7a329ebac9ae1da05e0c427d1f46094c2c8b7e (diff)
downloadmariadb-git-08be4e96a953a883240e9eebb38a9e8b965d3b1d.tar.gz
Merge sunlight.local:/local_work/tmp_merge-4.1-opt-mysql
into sunlight.local:/local_work/tmp_merge-5.0-opt-mysql mysql-test/t/select.test: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/func_group.result: Manual merge mysql-test/r/select.result: Manual merge mysql-test/r/subselect.result: Manual merge
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 93b0201b8f5..f6f45aea41e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -679,6 +679,24 @@ JOIN::optimize()
DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
+ /*
+ Extract all table-independent conditions and replace the WHERE
+ clause with them. All other conditions were computed by opt_sum_query
+ and the MIN/MAX/COUNT function(s) have been replaced by constants,
+ so there is no need to compute the whole WHERE clause again.
+ Notice that make_cond_for_table() will always succeed to remove all
+ computed conditions, because opt_sum_query() is applicable only to
+ conjunctions.
+ */
+ if (conds)
+ {
+ COND *table_independent_conds=
+ make_cond_for_table(conds, PSEUDO_TABLE_BITS, 0);
+ DBUG_EXECUTE("where",
+ print_where(table_independent_conds,
+ "where after opt_sum_query()"););
+ conds= table_independent_conds;
+ }
}
}
if (!tables_list)