When trying to understand how to alleviate pressure from our PostgreSQL instances, we were using a query like this:
Which displays the 12 most expensive queries that postgres has spent time doing. It’s pretty useful for finding out where you should be putting indexes, or where you can change your application code to alleviate the pressure.
Once you’ve optimized all the things on the posts table and deployed out new code, you will want to get those statistics updated. I had a hard time figuring this one out, so I’m leaving it here for myself for later: