If your problem is speed, Ruby & Python probably aren't going to help. Query optimizations typically yield a lot of bang for the buck. Once you've harvested all of the low-hanging fruit there, in-memory caching (memcached, redis) can also bring a lot to the table.