Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>mysql2</code> is meant as a more modern <em>replacement</em> for the existing <code>mysql</code> gem, which has been stale for a while now. I also heard that the author isn't supporting it anymore and instead recommends everyone use his pure-ruby version since it's compatible with more Ruby implementations (but is <em>much</em> slower).</p> <p>The first issue with the <code>mysql</code> gem is it doesn't do any type casting in C, it gives you back ruby strings which you then have to convert into proper ruby types. Doing that in pure-ruby is extremely slow, and creates objects on the heap that never needed to existing in the first place. And as we all know, Ruby's GC is it's primary reason for it's slowness. So it's best to avoid it and do as much in pure C as you can.</p> <p>Second is that it blocks the <em>entire</em> ruby VM while connecting, sending queries and waiting for responses, and even closing the connection. <code>mysqlplus</code> definitely helps with this issue, but only for sending queries as far as I know.</p> <p><code>mysql2</code> aims to solve these problems while keeping the API extremely simple. <code>Eric Wong</code> (author of Unicorn) has contributed some awesome patches that make nearly everything non-blocking and/or release the GVL in Ruby. The <code>Mysql2::Result</code> class implements Enumerable so if you know how to use an Array, you know how to use it.</p> <p>I'm only aware of a few people using it in production right now but it is being evaluated at Twitter, WorkingPoint and UserVoice too.</p> <p>I'm also in talks with <code>Yehuda</code> about it being the recommended/default for Rails 3 when it ships. Some of its techniques and optimizations are also going to be brought into DataObjects' <code>do_mysql</code> driver soon as well.</p> <p>The ActiveRecord driver should be pretty solid at the moment. All you should need to do is have the gem installed, and change your adapter name in database.yml to <code>mysql2</code>.</p> <p>If you're interested in using it, give it a try. I'm quick to push fixes if you find any issues ;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload