title: Performance difference between Innodb and Myisam in Mysql
body: <p>I have a mysql table with over 30 million records that was originally being stored with myisam. Here is a description of the table:</p>
  
  <p><img src="https://i.stack.imgur.com/aAfa4.png" alt="describe_table"></p>
  
  <p>I would run the following query against this table which would generally take around 30 seconds to complete. I would change @eid each time to avoid database or disk caching.</p>
  
  <pre><code>select count(fact_data.id) 
      from fact_data 
      where fact_data.entity_id=@eid 
          and fact_data.metric_id=1
  </code></pre>
  
  <p>I then converted this table to innoDB without making any other changes and afterwards the same query now returns in under a second every single time I run the query. Even when I randomly set @eid to avoid caching, the query returns in under a second. </p>
  
  <p>I've been researching the differences between the two storage types to try to explain the dramatic improvement in performance but haven't been able to come up with anything. In fact, much of what I read indicates that Myisam should be faster.</p>
  
  <p>The queries I'm running are against a local database with no other processes hitting the database at the time of the tests. </p>