Bug #3759 | LEFT JOIN not fully optimized with IN condition in where | ||
---|---|---|---|
Submitted: | 14 May 2004 11:48 | Modified: | 30 Aug 2004 17:15 |
Reporter: | Martin Friebe (Gold Quality Contributor) (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.0.18 | OS: | FreeBSD (freebsd (possible all)) |
Assigned to: | Timour Katchaounov | CPU Architecture: | Any |
[14 May 2004 11:48]
Martin Friebe
[17 May 2004 12:58]
Martin Friebe
Also just seen the differnece in the output of explain between =4 and in(4). Is there are reason why the ref for t2 is differnt (const vs NULL)? Should an IN (single value) be treated like an = ?
[28 May 2004 5:01]
MySQL Verification Team
Verified against latest 4.0 bk tree.
[30 Aug 2004 17:15]
Timour Katchaounov
Solution: The cause of the bug is that Item_func_in::fix_fields did not fully update its used_table_cache. This was the cause for not_null_tables in setup_conds() to be still 0 after the call not_null_tables= (*conds)->not_null_tables(); As a result the condition in setup_conds() if ( ... (table->table->map & not_null_tables) ...) failed, which was the cause for the ON expression not to be added to conds, and later the optimizer couldn't detect that it could apply the OUTER JOIN ==> JOIN optimization.