title: First query after mysql reboot is slow
body: <p>I am not as experienced with the backend of mysql and am having the following situation.</p>
  
  <p>Each night I have a script that turns off our mysql database and rsyncs the mysql folder to another. Afterwards mysql is turned on.</p>
  
  <p>Later, mysql is accessed by either a bash script or by a web application.</p>
  
  <p>After each restart, the first few queries that come in either through the bash script or webapp are really slow(stuff that takes 10 seconds takes 3 minutes). Once the slow queries finish or timeout, the queries run at normal speed. Also, when I login to mysql through the command line, all is fine afterwards and queries run at expected speeds.</p>
  
  <p>I believe that the slowdown is because <em>normally</em> MySQL reads all the table information when I login(assuming no -A option is used) or after the first queries already access the necessary meta-table information.</p>
  
  <p>My question is: How can I speed this process up through a bash script so I avoid the slow queries/manual login? Do I just do a dummy select on the necessary tables, or is there a smarter way getting the table information?</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>CentOS 5.8</li>
  <li>Mysql 5.1 with MyISAM engine</li>
  </ul>
  
  <p>Thanks!</p>