title: IN clause not using index
body: <p>Here is the table definition</p>
  
  <pre><code>CREATE TABLE `dt_prdtime` (
    `TCompany` varchar(3) NOT NULL DEFAULT '',
    `TPerCode` varchar(8) NOT NULL,
    `TBegDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'วันที่',
    `TQPay` int(1) NOT NULL DEFAULT '2',
    `TYear` int(4) NOT NULL,
    `TMonth` int(2) NOT NULL,
    PRIMARY KEY (`TCompany`,`TPerCode`,`TBegDateTime`),
    KEY `TMonth` (`TMonth`) USING BTREE,
    KEY `TPerCode` (`TPerCode`,`TYear`,`TMonth`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  </code></pre>
  
  <p>And this is data sample. This table has 10000+ records and value in <code>TMonth</code> field varies</p>
  
  <pre><code>+----------+----------+---------------------+-------+-------+--------+
  | TCompany | TPerCode | TBegDateTime        | TQPay | TYear | TMonth |
  +----------+----------+---------------------+-------+-------+--------+
  | S10      | 000001   | 2016-01-02 17:33:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-02 07:48:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-03 17:39:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-03 07:30:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-04 17:49:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-04 07:54:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-05 17:50:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-05 07:36:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-06 17:37:00 |     1 |  2016 |      1 |
  | S10      | 000001   | 2016-01-06 07:35:00 |     1 |  2016 |      1 |
  +----------+----------+---------------------+-------+-------+--------+
  </code></pre>
  
  <p>With <code>EXPLAIN</code>, This query uses <code>TMonth</code> index:</p>
  
  <pre><code>SELECT * FROM dt_prdtime WHERE TMonth = 5
  </code></pre>
  
  <p>while this one refuses to use the index:</p>
  
  <pre><code>SELECT * FROM dt_prdtime WHERE TMonth IN (5,6)
  </code></pre>
  
  <p>I tested with another simple table, </p>
  
  <pre><code>CREATE TABLE `table1` (
    `id` int(11) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  
  SELECT * FROM table2 WHERE id IN (5,6)
  </code></pre>
  
  <p>and the index for this table was used</p>
  
  <p>Can anybody explain this? Is there something wrong with <code>dt_prdtime</code> table?</p>