Let me tell you a story of the day our users face slowness in our application. As we investigate further, we found out that our RDS instance CPU use is at constant 100%.
One of the things we do is to increase our instance size, and that is not helpful. Which lead to one of my go-to tools in PostgreSQL for this kind of issue, pg_stat_statements
.
In a rails application, there's many queries to the database. Tracing individual queries can be painful. There is where pg_stat_statements
come in. When enabled, this logs all database queries to the…