title: MySQL2 Gem: Lost connection to MySQL server during query
body: <p>I'm experiencing the following exception:</p>
  
  <pre><code>in `query': Lost connection to MySQL server during query (Mysql2::Error)
  </code></pre>
  
  <p>It's very difficult to replicate. When I execute the same MySQL Command manually it might work without any problem.</p>
  
  <p>I have narrowed it down as follows:</p>
  
  <p>1.) I <strong>might</strong> get this exception when I select a lot of records from a big table.
     e.g. I have a database with 10million records (and ~50 columns) and I'm getting this error when I select 100k records in one query.</p>
  
  <p>2.) When I do 1.) repeatedly for e.g. 10 times it seems to be more likely that I will get this exception, even when I use new MySQL connections with each query.</p>
  
  <p>I have pasted my MySQL Variables here: <a href="http://pastebin.com/D5tfF8Tf" rel="nofollow">http://pastebin.com/D5tfF8Tf</a></p>
  
  <p>EDIT: I noticed that MySQL is constantly running at ~40% CPU Usage</p>
  
  <pre><code>mysql    22811 40.9  0.3 4281712 244212 ?      Ssl  Oct31 2909:26 /usr/sbin/mysqld
  </code></pre>