Heroku "psql: FATAL: remaining connection slots are reserved for non-replication superuser connections"

nathancahill picture nathancahill · Aug 7, 2012 · Viewed 187.1k times · Source

I'm developing an app on Heroku with a Postgresql backend. Periodically, I get this error message when trying to access the database, both from the CLI and from loading a page on the server:

psql: FATAL: remaining connection slots are reserved for non-replication superuser connections

Anyone seen this before or please help point me in the right direction?

Answer

kgrittn picture kgrittn · Aug 7, 2012

You either need to increase the max_connections configuration setting or (probably better) use connection pooling to route a large number of user requests through a smaller connection pool.

https://wiki.postgresql.org/wiki/Number_Of_Database_Connections