DEV Community

Cover image for Reports performance improvement
fedeagripa
fedeagripa

Posted on

2 3

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

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay