Database Reference
In-Depth Information
This will then cause any additional connections to receive the error message:
FATAL: too many connections for role "fred".
You can eliminate this restriction by setting the value to -1 .
It's possible to set the limit to zero or any positive integer. You can set this to a number other
than max_connections , though it is up to you to make sense of that if you do.
Setting the value to zero will completely restrict normal connections. Note that even if you set
connection limit to zero for superusers, they will still be able to connect.
How it works...
The connection limit is applied during session connection. Raising this limit would never affect
any connected users. Lowering the limit doesn't have any effect either, unless they try to
disconnect and reconnect.
So if you lower the limit, you should immediately check to see whether there are more
sessions connected than the new limit you just set, otherwise there may be some surprises
if there is a crash.
postgres=> SELECT rolconnlimit
FROM pg_roles
WHERE rolname = 'fred';
rolconnlimit
--------------
1
(1 row)
postgres=> SELECT count(*)
FROM pg_stat_activity
WHERE usename = 'fred';
count
-------
2
(1 row)
If you have more connected sessions than the new limit, you can ask them politely to
disconnect, or apply the recipe Pushing users off the system .
Users can't raise or lower their own connection limit, in case you were worried they might be
able to override this somehow.
 
Search WWH ::




Custom Search