Max Connections

Handling Max Connections in PostgreSQL

Determining PostgreSQL Max Connections

You can determine how many max connections your PostgreSQL server is configured for by using a simple SQL select query:

select name, setting from pg_settings where name = 'max_connections';

Determining Whether You Have Exceeded Max Connections in PostgreSQL

You will get an error message like this:

org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser

You can close some connections by stopping some applications, or even forcing it by restarting PostgreSQL.