MariaDB [j28]> explain SELECT * FROM t1 WHERE (f3 = 83) OR (f10 = 'z' AND f3 IS NULL);
+----+-------------+-------+-------------+---------------+------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------------+---------------+------+---------+-------+------+-------+
| 1 | SIMPLE | t1 | ref_or_null | f3 | f3 | 5 | const | 2 | |
+----+-------------+-------+-------------+---------------+------+---------+-------+------+-------+
1 row in set (0.01 sec)
Note the lack of "Using where". Debugging shows that
- WHERE clause is indeed not checked.
- it is not there because it was removed by the "remove parts of WHERE that are guaranteed to be true by use of ref-access" functionality inside make_cond_for_table().
In 5.3:
MariaDB [j28]> explain SELECT * FROM t1 WHERE (f3 = 83) OR (f10 = 'z' AND f3 IS NULL); ------- -----+- ------+ ------- ------+ ------- ------- -+----- -+----- ----+-- -----+- -----+- ------+ ------- -----+- ------+ ------- ------+ ------- ------- -+----- -+----- ----+-- -----+- -----+- ------+ ------- -----+- ------+ ------- ------+ ------- ------- -+----- -+----- ----+-- -----+- -----+- ------+
+----+-
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-
| 1 | SIMPLE | t1 | ref_or_null | f3 | f3 | 5 | const | 2 | |
+----+-
1 row in set (0.01 sec)
Note the lack of "Using where". Debugging shows that for_table( ).
- WHERE clause is indeed not checked.
- it is not there because it was removed by the "remove parts of WHERE that are guaranteed to be true by use of ref-access" functionality inside make_cond_