Reports performance improvement

fedeagripa

fedeagripa

Posted on August 20, 2020

Reports performance improvement

Are you tired of fighting with the performance of your reports and overloading your database?

Fight
Well, here I bring you a really simple Rails 6 solution!

  • Use new Rails6 Multiple Databases configuration
    To do so you can check my other post

  • Switch your reports to use the replica database

As an extra you can also use readonly_slow:

ActiveRecord::Base.connected_to(database: { readonly_slow: :replica }) do
  # runs a long query while connected to the +replica+ using the readonly_slow role.
  User.run_a_huge_query
end
Enter fullscreen mode Exit fullscreen mode
  • Voila, that's all! voila
💖 💪 🙅 🚩
fedeagripa
fedeagripa

Posted on August 20, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Reports performance improvement
rails Reports performance improvement

August 20, 2020