我在我的 NodeJS 后端服务中使用 PostgreSQL。突然间,当我启动服务时,我遇到了以下错误
connection error error: sorry, too many clients already.
PostgresSQL 连接配置
const pg = require(“pg”);
const client = new pg.Client({
host: “txslmxxxda6z”,
user: “mom”,
password: “mom”,
db: “mom”,
port: 5025
});
由于上述错误,我无法查询数据库。我无法解决这个问题。你能提出解决方案吗
最佳答案
下面的查询会帮助你。
select max_conn,used,res_for_super,max_conn-used-res_for_super res_for_normal
from
(select count(*) used from pg_stat_activity) t1,
(select setting::int res_for_super from pg_settings where name=$$superuser_reserved_connections$$) t2,
(select setting::int max_conn from pg_settings where name=$$max_connections$$) t3
关于node.js - 错误 : sorry, 已经有太多客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50947066/