# Postgres using 100% of CPU

**URL:** <https://meta.discourse.org/t/postgres-using-100-of-cpu/45261>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [June 5, 2016, 12:19am UTC](https://meta.discourse.org/t/postgres-using-100-of-cpu/45261 "2016-06-05T00:19:26Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)\
**Post date:** [June 5, 2016, 12:38am UTC](https://meta.discourse.org/t/postgres-using-100-of-cpu/45261/5 "2016-06-05T00:38:57Z")

</div>

To see exactly what queries are being executed you can run something like the following from the console:

```bash
cd /var/discourse/
./launcher enter app
sudo -u postgres psql -c "select * from pg_stat_activity WHERE state='active'";

```

Try running this a couple of times with a 3/4 minute wait in-between, capturing the output each time.

---

_[View the full topic](https://meta.discourse.org/t/postgres-using-100-of-cpu/45261)._
