Bug #53793 | "early NULL filtering" not done for outer join converted to inner join | ||
---|---|---|---|
Submitted: | 19 May 2010 9:52 | Modified: | 19 May 2010 12:23 |
Reporter: | Guilhem Bichot | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 6.0-codebase-bugfixing | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[19 May 2010 9:52]
Guilhem Bichot
[19 May 2010 12:23]
MySQL Verification Team
Thank you for the bug report.
[19 May 2010 12:56]
Guilhem Bichot
in next-mr-bugfixing aelkin@mysql.com-20100518084747-kvvy483pn3n3y4tv there is no "Using where" even in the JOIN case. But I see that add_not_null_conds(), for the JOIN case, does add a IS NOT NULL condition, looks like it gets lost afterwards? This would deserve investigation as well.
[19 May 2010 18:35]
Guilhem Bichot
sorry, replace "null_row" by "maybe_null"
[28 Sep 2010 13:39]
Guilhem Bichot
If I do prepare stmt from 'explain extended SELECT table1.pk, table2.col_int_key, table1.col_int_key, table2.pk FROM C table1 LEFT JOIN C table2 ON table2 .`col_int_key` = table1 .`col_int_key` WHERE table2 .`pk`'; execute stmt; execute stmt; the bug is seen in the first EXECUTE but not the second. It could well be related to http://bugs.mysql.com/bug.php?id=54484
[1 Dec 2015 14:40]
Guilhem Bichot
Posted by developer: True in 5.5 and newer. Current testcase: create table t(a int, b int, key(b)); explain format=json select * from t t1 join t t2 on t2.b=t1.a where t2.a is not null; -> for t1 we see: "attached_condition": "(`test`.`t1`.`a` is not null)" explain format=json select * from t t1 left join t t2 on t2.b=t1.a where t2.a is not null; This is converted to inner join: Note (Code 1003): /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t` `t1` join `test`.`t` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (`test`.`t2`.`a` is not null)) but no attached_condition on t1.