在连接到Postgres RDS数据库10次后,我开始得到错误-Too Many Connections
或Timed-out waiting to acquire database connection
。
但是当我检查max_connections
时显示405。pg_roles
显示-1为rollconnlimit
。如果没有达到上限,为什么该用户的并发连接不能超过10个?
@jjanes对另一个问题的评论给了我一个指针。瓶颈是来自pg_database的datconnlimit设置。使用下面的查询更改它修复了这个问题:-
ALTER DATABASE with CONNECTION LIMIT 50