title: How to efficiently query very large MySQL table on primary key range
body: <p>I'm trying to query a very large MySQL table where the primary key takes on a range of values, but the query is too slow. I'm wondering if there is a faster way to do this, especially considering the following:</p>
  
  <pre><code>SELECT * FROM t1 WHERE id in (1,2,3,4,5,6);
  </code></pre>
  
  <p>runs instantaneously</p>
  
  <pre><code>SELECT * FROM t1 WHERE id between 1 and 6;
  </code></pre>
  
  <p>takes much longer. </p>
  
  <p>The former expression won't work for me since I need values in the range [996737629,1006737629]. I am not able to modify the database. </p>