title: Mysql "SELECT *' hangs
body: <p>My MySQL database has two databases, let's call them <code>apple</code> and <code>banana</code>. <code>apple</code> has one table, let's call it <code>mydata</code>.</p>
  
  <pre><code>&gt; use apple;
  Database changed
  
  &gt; SELECT * FROM mydata;
  ...
  3379 rows in set (0.00 sec)
  
  &gt; SELECT mydata.* FROM mydata;
  ...
  3379 rows in set (0.00 sec)
  </code></pre>
  
  <p>Everything works fine when I use <code>SELECT *</code> within the same database. As soon as I switch databases I get strange behavior.</p>
  
  <pre><code>&gt; use banana;
  Database changed
  
  &gt; SELECT mydata.* FROM apple.mydata;
  ...
  3379 rows in set (0.00 sec)
  
  &gt; SELECT * FROM apple.mydata;
  [hangs!]
  </code></pre>
  
  <p>Why does this hang? What does MySQL think the <code>*</code> means that causes it to hang, while <code>mydata.*</code> is more specific and does not cause a hang. </p>
  
  <p>Notes:</p>
  
  <ul>
  <li>According to 'SHOW FULL PROCESSLIST', the connection running the hanging query is not running a command, but is in state "Sleep".</li>
  <li>This problem is intermittent: my queries did this for a year and a half, and then all started freezing a few hours ago. Five minutes ago, they stopped freezing, and there is currently no problem.</li>
  </ul>
  
  <p>Any ideas why an unqualified <code>SELECT *</code> doesn't run, while a qualified <code>SELECT mydata.*</code> runs instantly?</p>
  
  <p>Thanks,</p>
  
  <p>Jonathan</p>