fedeagripa
Posted on August 20, 2020
Are you tired of fighting with the performance of your reports and overloading your database?
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 postSwitch 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
- Voila, that's all!
💖 💪 🙅 🚩
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.