kelmerp/headline_sentiment_rating — pull request #11 by kelmerp (2013-09-29 15:10:12+00:00)
Title: Index on headline date

I ran the following code block w/ and without indexes:

h = Headline.pluck(:date).uniq! #grab all the unique dates from the headlines table; returned 4333 unique dates
puts Benchmark.measure { h.each { |day| Headline.get_average(day) } } #get the avg sentiment_score for each day

w/o index on date this query took 113.335807 seconds
w/index on date this query took 8.273596 seconds