we can merge this from 5.6 or implement it differently, if needed
It seems that MySQL 5.6 doesn't have this optimization yet.
CREATE TABLE `dept_emp` ( `emp_no` int(11) NOT NULL, `dept_no` char(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL, PRIMARY KEY (`dept_no`,`emp_no`), KEY `ix_fromdate` (`from_date`), KEY `ix_empno_fromdate` (`emp_no`,`from_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; mysql> explain select * from dept_emp where (emp_no, dept_no) in ( (10017,'d001'), (10208, 'd001')); +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+ | 1 | SIMPLE | dept_emp | ALL | NULL | NULL | NULL | NULL | 331143 | Using where | +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+ 1 row in set (0.00 sec) mysql> select version(); +------------+ | version() | +------------+ | 5.6.15-log | +------------+ 1 row in set (0.00 sec)
It seems that MySQL 5.6 doesn't have this optimization yet.