Bug #64016 Optimizer doesn't seem to take into account enum definition
| Submitted: | 12 Jan 2012 19:38 | Modified: | 13 Jan 2012 6:57 |
|---|---|---|---|
| Reporter: | Oleksandr Konovalov | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 5.5.19 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[13 Jan 2012 6:57]
Valeriy Kravchuk
Thank you for the problem report.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Explain doesn't show "impossible where" when comparing value of enum column with impossible value. How to repeat: CREATE TABLE test_1(id int not null auto_increment PRIMARY KEY, val enum('A','B') not null); insert into test_1(val) values ('A'); 1. explain select * from test_1 where val is null; 2. explain select * from test_1 where val ='C'; The first shows "impossible where" in Extra (which is correct because val defined as not null), but the second one doesn't. According to table definition, there is no way val can contain 'C'. Shouldn't optimizer generate the same 'Impossible where' ? Suggested fix: If it's supposed behaviour, it's probably worth mentioning in documentation. If not, performance gain from checking column definition in such cases can be huge especially for large tables.