title: Slow SQL Queries after listing larger table
body: <p>Lets call the database in question <code>db</code> and lets also call the smaller table with a few hundred rows <code>x</code> and the larger with above 10k rows <code>y</code>.</p>
  
  <hr>
  
  <p>When I issue a query to table <code>x</code>, the query is issued without any problems in about <strong>0.0003</strong> seconds using the basic query <code>SELECT * FROM x LIMIT 25</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/fpxAA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fpxAA.png" alt="enter image description here"></a></p>
  
  <p>This applies to all smaller tables in <code>db</code> with all queries taking about 0,3ms to process.</p>
  
  <p>However, after issuing the same basic query <code>SELECT * FROM y LIMIT 25</code> to table <code>y</code> the process is significantly slower. Sometimes taking up <strong>100ms</strong> to process.</p>
  
  <p><a href="https://i.stack.imgur.com/AzOVk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AzOVk.png" alt="Snip"></a></p>
  
  <hr>
  
  <p>It effects the query time for table <code>y</code> <strong>and</strong> the query time for table <code>x</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/JXVhv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JXVhv.png" alt="Snip"></a></p>
  
  <hr>
  
  <p>The problem seems to go away after either re-issuing the listing of table <code>x</code> a few times or listing another small table in <code>db</code>. A table from another database will still be slow.</p>
  
  <p>I've read a lot about optimization and performance enhancements that can be made to increase query speeds. None of them seem to cover this issue however.</p>