Note.grouped_awards generates queries that don't use indexes
This method looks as following:
def grouped_awards
notes = {}
awards.select(:note).distinct.map do |note|
notes[note.note] = where(note: note.note)
end
notes["thumbsup"] ||= Note.none
notes["thumbsdown"] ||= Note.none
notes
end
Here the "note" column is used to match notes with a given value, but this column isn't indexed.
As per http://performance.gitlab.net/dashboard/db/note-grouped_awards the timings usually don't seem too bad, except for an occasional spike: