miller_121
miller_121

Reputation: 673

How to find out the connection limit per user on Postgresql?

I need to find out if a connection limit has been set on a Postgresql database on a per user basis.

I know you can set such a limit using:

ALTER USER johndoe WITH CONNECTION LIMIT 2;

Can you check this in the pg_users table?

Upvotes: 62

Views: 88204

Answers (2)

DrColossos
DrColossos

Reputation: 12998

Whilst connected to the database you want to get this information

SELECT rolname, rolconnlimit
FROM pg_roles
WHERE rolconnlimit <> -1;

More details are available at http://www.postgresql.org/docs/current/static/view-pg-roles.html

Upvotes: 62

user330315
user330315

Reputation:

This information is available in the column rolconnlimit in the view pg_roles
http://www.postgresql.org/docs/current/static/view-pg-roles.html

For roles that can log in, this sets maximum number of concurrent connections this role can make. -1 means no limit.

Upvotes: 38

Related Questions