database 如何在 Postgresql 上找出每个用户的连接限制?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4616803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find out the connection limit per user on Postgresql?
提问by miller_121
I need to find out if a connection limit has been set on a Postgresql database on a per user basis.
我需要查明是否已在每个用户的基础上对 Postgresql 数据库设置了连接限制。
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?
你能在 pg_users 表中检查一下吗?
采纳答案by a_horse_with_no_name
This information is available in the column rolconnlimit in the view pg_roles
http://www.postgresql.org/docs/current/static/view-pg-roles.html
此信息在视图 pg_roles http://www.postgresql.org/docs/current/static/view-pg-roles.html 的rolconnlimit 列中可用
For roles that can log in, this sets maximum number of concurrent connections this role can make. -1 means no limit.
对于可以登录的角色,这会设置此角色可以建立的最大并发连接数。-1 表示没有限制。
回答by DrColossos
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
更多详细信息请访问http://www.postgresql.org/docs/current/static/view-pg-roles.html