How to optimize postgres and the discourse DB

  • Sometimes DB gets fired because of some queries, and we were told that we need to optimize the PostgreSQL, any idea hot to achieve this?
    In the screen below this is our DB resources
    • CPU: 4 vcpu
    • Memory: 22 GB

1 Like

Hello all, I’m working with @Abdelrahman_MoHamed on this. We recently migrated a site with roughly 500k topics and 3.5 million users to discourse. We are self hosted on GCP. During this process our partner who assisted with the migration mentioned it might make sense to optimize Postgres to get proper performance from the DB. Our assumption was the DB would come optimized for discourse out of the box (maybe it is?). However given their (the partner suggestion) we wanted to follow up here.

Long story short are these some common ways to optimize Postgres for a DB with the numbers posted here?

Thanks in advance for the help!

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.

1 Like

Thanks @Ed_S we will add more data here soon. Just monitoring things for now. Appreciate the response.

1 Like