Symptoms
Connection to BA is slow, sometimes billing is not responsive, lots of statement timeout errors. Attempt to enter the database result in the error message:
[root@bm ~]# psql -h database.ip -U pba
psql: FATAL: remaining connection slots are reserved for non-replication superuser connections
Cause, resolution
PosrgreSQL is overloaded.
- Check the number of maximum connections to the database -
max_connections
in /var/lib/pgsql/data/postgresql.conf. - Check the number of current connections, e.g. by listing the processes (as select from pg_stat_activity is not possible due to impossibility to enter the database).
- Check what used so many connections, verify if they are really required or there is some way to use less connections.
- Resolve the situation either by restricting access to the database to some scripts or whatever uses it or increase the number of
max_connections
.