# Primary Postgres database process (postmaster) eating all CPU

**URL:** https://meta.discourse.org/t/primary-postgres-database-process-postmaster-eating-all-cpu/84410
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [April 2, 2018, 10:12pm UTC](https://meta.discourse.org/t/primary-postgres-database-process-postmaster-eating-all-cpu/84410 "2018-04-02T22:12:13Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 3, 2018, 8:33pm UTC](https://meta.discourse.org/t/primary-postgres-database-process-postmaster-eating-all-cpu/84410/5 "2018-04-03T20:33:06Z")

</div>

> [@mpalmer](#):
>
> It’s the max\_connections parameter in postgresql.conf. I don’t see a tunable for that in discourse\_docker, so I suspect you’ll need to play games with a pups exec stanza to make the edit.

Not one for playing games when they’re not necessary, I went into the data container, edited postgresql.conf by hand, doubled `max_connections` (from 100 to 200) and, LO! it seems that all is well.

I don’t understand just why I’ve not encountered this before or why this is the solution here. The database doesn’t seem that big and the traffic doesn’t seem that high.

Edit: I have played the games and won!

If anyone else cares. . . stick this in `data.yml` in `hooks` in the `after_postgres` section. I put it after the `-exec` section.

```plaintext
    # double max_connections to 200
    - replace:
        filename: "/etc/postgresql/9.5/main/postgresql.conf"
        from: /#?max_connections *=.*/
        to: "max_connections = 200"

```

---

_[View the full topic](https://meta.discourse.org/t/primary-postgres-database-process-postmaster-eating-all-cpu/84410)._
