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

60,366

Solution 1

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.

Solution 2

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

Share:
60,366
miller_121
Author by

miller_121

e-learning, software, and Model Driven Engineering are what make me tick.

Updated on July 09, 2022

Comments

  • miller_121
    miller_121 almost 2 years

    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?

  • Nick
    Nick almost 4 years
    Note: this will (correctly) return nothing if you don't have any custom roll limits set up.