How to optimize postgres and the discourse DB

Do you have more detailed evidence that the DB is the limiting factor, or is the cause of these CPU loads? Output of ps or top, for example.

If it is the DB, I imagine there’s some way of asking it which queries it is working on.

Such details might be helpful.