Let's say I have an articles table with thousands of articles. I am trying to figure out the most performant way to find the 5 longest article names, not the articles themselves.
This is what I have so far:
def self.five_longest_article_names
limit(5).order("(LENGTH(name)) desc").pluck(:name)
end
But that uses SQL. Is there an ActiveRecord query that I could have performed instead?