remaining connection slots are reserved for non-replication superuser

Hallo an all,

habe eine Webseite in Php programmiert und alles umgeschrieben von MySQL zu PostgreSQL…
Jetzt gibt es folgendes Problem:

The situation with PostgreSQL on Mac OS X Snow Leopard installed with Macports:

I have two databeses with different kind of tables.
I have 4 Login roles(Users) created with pgAdmin3 and 4 Login groups

All have not the Superuser or admin rights.

Each table have Privilegs from the Group and to each Group I add a user with login function.
Groups can not login - only users.
And each user got the privileges from the Groups to select, delete or … the table.

The postgresql have following content:

hba_file = '/opt/local/share/postgresql90/pg_hba.conf

- Connection Settings -

listen_addresses = ‘localhost’
port = 5432 # (change requires restart)
max_connections = 64 # (change requires restart)

I tried 1000 max_connection - but still not help.


I have following error always coming - from the postgres.log:

LOG: database system is ready to accept connections
LOG: autovacuum launcher started
FATAL: remaining connection slots are reserved for non-replication superuser connections
FATAL: remaining connection slots are reserved for non-replication superuser connections
FATAL: remaining connection slots are reserved for non-replication superuser connections

Koenne Sie bitte helfen? Ich finde Irgendwie keine Loesung.

Always a lot of connection problems with one user. What I will do if I have coming cupple thousend user per day or per hour to my website?

Please help.

Maybe you have persistant connections enabled?

Please login as a superuser and look into “pg_stat_activity”.

I opened a persistant connection with php pg_pconnect.

I changed it now. Thank you!

Please see below pg_stat_activity

11874;“postgres”;518;16385;“ralphleonhardt”;“pgAdmin III - Browser”;"::1";49842;“2011-01-28 18:00:46.768543+03”;"";“2011-01-28 18:00:47.660786+03”;f;""
16576;“db175054258”;519;16385;“ralphleonhardt”;“pgAdmin III - Browser”;"::1";49843;“2011-01-28 18:00:47.0421+03”;"";“2011-01-28 18:00:47.402387+03”;f;""

After 16 open process the server says - nothing is anymore free. But I put there at least 64 open connections.

I open with php more and more new persistant connections till they are all occupied.

Thank you for your help.

You can disable persistent connections in php.ini at all.
How many different databases is your application using? How many webserver backends/processes/threads are running?

You need at least “number webserver processes/threads” * “number databases” + superuser_reserved_connections in “max_connections”.