title: MySQL fetch time optimization
body: <p>oI have a table with 2 millions of registers, but it will grow much more soon. Basically this table contains points of interest of an image with respective descriptors. When I'm trying to execute query that selects points that are spatially near to the query points, total execution time takes too long. More precisely Duration / Fetch = 0.484 sec / 27.441 sec. And the query is quite simple, which returns only ~17000 rows.</p>
  
  <p>My query is: </p>
  
  <pre><code>SELECT fp.fingerprint_id, fp.coord_x, fp.coord_y, fp.angle,
  fp.desc1, fp.desc2, fp.desc3, fp.desc4, fp.desc5, fp.desc6, fp.desc7, fp.desc8, fp.desc9, fp.desc10,
  fp.desc11, fp.desc12, fp.desc13, fp.desc14, fp.desc15, fp.desc16, fp.desc17, fp.desc18, fp.desc19,
  fp.desc20, fp.desc21, fp.desc22, fp.desc23, fp.desc24, fp.desc25, fp.desc26, fp.desc27, fp.desc28,
  fp.desc29, fp.desc30, fp.desc31, fp.desc32
  FROM fingerprint fp 
  WHERE 
  fp.is_strong_point = 1 AND 
  (coord_x BETWEEN 193-40 AND 193+40) AND (coord_y BETWEEN 49-15 AND 49+15 ) 
  LIMIT 1,1000000;
  </code></pre>
  
  <p>That is what I've done.</p>
  
  <ol>
  <li>I've tried to change <code>key_buffer_size</code> in <code>my.ini</code>, but didn't see much changes. </li>
  <li>In addition I've tried to set coord_x and coord_y as indexes, but query time became slower. </li>
  <li>The table is partitioned by range of coord_x field, which gave me better results.</li>
  </ol>
  
  <p>How I can reduce the Fetch time? Is it possible to reduce it to milliseconds?</p>