官方叙述如下:
Someone: Dude, the Mysql gem works fiiiiiine.
Me: It sure does, but it only hands you nil and strings for field values. Leaving you to convert them into proper Ruby types in Ruby-land - which is slow as balls.
Someone: OK fine, but do_mysql can already give me back values with Ruby objects mapped to MySQL types.
Me: Yep, but it's API is considerably more complex and can be ~2x slower.
Performance 有差别:
These results are from the query_with_mysql_casting.rb script in the benchmarks folder
user system total real
Mysql2
0.750000 0.180000 0.930000 ( 1.821655)
do_mysql
1.650000 0.200000 1.850000 ( 2.811357)
Mysql
7.500000 0.210000 7.710000 ( 8.065871)
另外,编码的兼容性上貌似也有差别。