Wednesday 23 May 2007

Improve Default Rails Database Performance

Active Record (AR) is slow. All that nice reflection comes at a price. You should use AR to prototype your app, then take a look at the logs.
1. Sort your development log.
If a database query is only run a few times, let AR handle it. If one is being run a 1000 times then we should pull it out and tweak it.
2. Pull the SQL from the log
Rails has already done the hard work for us, right?
3. Tweak the SQL
Stick the tweaked DB queries in your models and things should move along nicely...

RailsConf 2007


Ok, I've just got back from RailsConf 2007, so the next few posts will be about stuff I picked up while I was there. I found the conference a bit light on technical content so don't expect anything ground breaking, just some general advice. For now, here's where you can find most of the slides from the conference.