title: MySQL Multiple column index
body: <p>Ok, I have the following MySQL table structure:</p>
  
  <pre><code>CREATE TABLE `creditlog` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `memberId` int(10) unsigned NOT NULL,
    `quantity` decimal(10,2) unsigned DEFAULT NULL,
    `timeAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `reference` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `memberId` (`memberId`),
    KEY `timeAdded` (`timeAdded`));
  </code></pre>
  
  <p>And I'm querying it like this:</p>
  
  <pre><code>SELECT SUM(quantity) FROM creditlog where timeAdded&gt;'2016-09-01' AND timeAdded&lt;'2016-10-01' AND memberId IN (3,6,8,9,11)
  </code></pre>
  
  <p>Now, I also use the <code>use index (timeAdded)</code> because due to the number of entries it is more convenient. Explaining the above query shows: </p>
  
  <pre><code>type -&gt; range,
  key -&gt; timeAdded,
  rows -&gt; 921294
  extra -&gt; using where
  </code></pre>
  
  <p>Meanwhile if I use the <code>memberId</code> INDEX it shows:</p>
  
  <pre><code>type -&gt; range,
  key -&gt; memberId,
  rows -&gt; 1707849
  extra -&gt; using where
  </code></pre>
  
  <p>Now, my question is it's possible to combine these 2 indexes somehow to be used together and reduce the surface of the query since I ll also need to add more conditions (on other columns). </p>