I have a Rails app (rails version 188.8.131.52 / ruby 2.6.3) that makes queries to a postgres database using ActiveRecord.
I want to reduce query latency.
I’m using NewRelic to understand what the slow queries are, and I see pretty much each one of them is spending time inside the
mon_synchronize method in monitor.rb
I’m attaching a few screenshots from NewRelic.
My question is - what is the reason ActiveRecord is taking this lock? Is there anything I can do to get a better response from the queries.
The database itself is pretty small - thousands of records.