Ruby on Rails, Activerecord, MySQL, Database.
To see the results of your query optimizations, use the Ruby’s Benchmark.realtime to time them. But note that databases like MySQL will often cache queries in memory so if you run the same query twice, the second time will always be faster. As such, be sure to clear the cache query between