Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
Find this code in sql_select.cc:
if (conds) |
{
|
conds= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, conds,
|
having= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, having,
|
having_equal, map2table, false);
|
and subsequent calls for ON and select list.
Print the conditions after the substitution.
MySQL prints the substituted WHERE in attaching_conditions_to_tables.original_condition:
select *
from t1, t2, t3
where
t1.a=t2.a and t2.a=t3.a and
11+ t1.a < (22 + t2.a) *(33 + t3.a) ;
{
"join_optimization": {
"select#": 1,
"steps": [
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "((`t1`.`a` = `t2`.`a`) and (`t2`.`a` = `t3`.`a`) and ((11 + `t1`.`a`) < ((22 + `t2`.`a`) * (33 + `t3`.`a`))))",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "(((11 + `t1`.`a`) < ((22 + `t2`.`a`) * (33 + `t3`.`a`))) and multiple equal(`t1`.`a`, `t2`.`a`, `t3`.`a`))"
},
{
"transformation": "constant_propagation",
"resulting_condition": "(((11 + `t1`.`a`) < ((22 + `t2`.`a`) * (33 + `t3`.`a`))) and multiple equal(`t1`.`a`, `t2`.`a`, `t3`.`a`))"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "(((11 + `t1`.`a`) < ((22 + `t2`.`a`) * (33 + `t3`.`a`))) and multiple equal(`t1`.`a`, `t2`.`a`, `t3`.`a`))"
}
]
}
},
...
{
"attaching_conditions_to_tables": {
"original_condition": "((`t2`.`a` = `t1`.`a`) and (`t3`.`a` = `t1`.`a`)
and ((11 + `t1`.`a`) < ((22 + `t1`.`a`) * (33 + `t1`.`a`))))",