High Performance MySQL - now with more Kick Ass!

I have the first version of this book, and have just used parts of this, the second version, to help setup a new MySQL server in a production environment.

This book has saved me hours already. Worth the price, right there.

If you do stuff with MySQL, you must have this book.

Posted by Tom Fri, 27 Jun 2008 04:05:00 GMT


jPod, the TV Show!

I recently read jPod the book by Douglas Coupland. Its a pretty good book, kind of weird – perhaps Quirky is a good description.

As a programmer in the video game industry, its kind of required reading

It turns our that CBC in Canada turned this into a TV Show)

This story works much better as a TV show!

Posted by Tom Fri, 27 Jun 2008 03:55:00 GMT


ATOP is my favorite Linux tool

I’m diagnosing a load problem with a server, and ATOP has helped me a lot.

For Ubuntu – ‘apt-get install atop’ works fine.

Here is the ATOP home page

Posted by Tom Sun, 08 Jun 2008 04:14:00 GMT


MySQL Data type changes which index to use

I tracked down a performance issue in my code today that was pretty subtle.

I have a table with a varchar column that contains a number, mainly for size reasons. This column has an index all to itself, so queries using the column should be pretty snappy, but they weren’t.

My code went something like this:

  find(:all, :conditions => "my_col = #{value}")

I know I shouldn’t have built the conditions that way, but that’s the way the code was. And the performance sucked!

Since my_col is actually a string, I need quotes around the value otherwise MySQL has to try to figure it out, and it misses the index completely!

So, in future, use the :conditions the correct way, as Active Record does a pretty good job of getting the quotes right!

So, why did I write the code this way?

The code I actually wrote is for the parameters to a call to update_all, and the documentation for update_all isn’t as clear as it could be on how the parameters work. The key is that both of the first 2 parameters to update_all are the same as a :conditions parameter to find (but without the :conditions symbol). So they can be a string, or an array that has Active Record parameter substitution.

Posted by Tom Thu, 05 Jun 2008 04:14:00 GMT