# Slow Sidekiq + Postmaster using 95%+ CPU (32 cores) after Postgresql Version Upgrade

**URL:** https://meta.discourse.org/t/slow-sidekiq-postmaster-using-95-cpu-32-cores-after-postgresql-version-upgrade/152983
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [May 27, 2020, 4:08pm UTC](https://meta.discourse.org/t/slow-sidekiq-postmaster-using-95-cpu-32-cores-after-postgresql-version-upgrade/152983 "2020-05-27T16:08:57Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![markersocial](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markersocial/32/170136_2.png) [@markersocial](https://meta.discourse.org/u/markersocial)
#### Post date: [May 28, 2020, 5:56am UTC](https://meta.discourse.org/t/slow-sidekiq-postmaster-using-95-cpu-32-cores-after-postgresql-version-upgrade/152983/19 "2020-05-28T05:56:17Z")

</div>

Ok so to follow up, everything still looks good, postmaster has calmed down drastically and sidekiq is moving really fast again.

To summarise on what worked in my scenario (with default db name of ‘discourse’):

```
cd /var/discourse/
./launcher enter app
sudo -u postgres psql
\c discourse

```

Then from the postgres console, each of these below were run. Each one takes a bit of time to complete, depending on DB size, heavy CPU usage for the first two also:

```
VACUUM FULL VERBOSE;

REINDEX DATABASE discourse;

VACUUM VERBOSE ANALYZE;

```

Note: I didn’t notice a difference until VACUUM VERBOSE ANALYZE; was ran as per @Falco’s recommendation, so the first two might not have been necessary. Though, the first two seemed to be key to fixing this issue [in the past](https://meta.discourse.org/t/very-slow-sidekiq-issue-with-large-queue-due-to-massive-numbers-of-unread-user-notifications/140716/62) on the previous version of Postgresql.

If you get an error like ‘ERROR: deadlock detected’ during REINDEX DATABASE discourse; - just try running it again until it works. This happened to me last time (previous Postgresql version).

There are some recommendations to run a concurrent reindex instead of the reindex above: [PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236#re-indexing-your-database)

However, note that @eboehnisch above got an error from the concurrent reindex, [see above](https://meta.discourse.org/t/slow-sidekiq-postmaster-using-95-cpu-32-cores-after-postgresql-version-upgrade/152983/14).

---

_[View the full topic](https://meta.discourse.org/t/slow-sidekiq-postmaster-using-95-cpu-32-cores-after-postgresql-version-upgrade/152983)._
