首页  

PostgreSQL 连接信息查询     所属分类 PostgreSQL 浏览量 158
psql: FATAL: 53300: remaining connection slots are reserved for non-replication superuser connections
普通用户的连接已满,保留用于非复制的超级用户连接

psql: FATAL:  53300: sorry, too many clients already
数据库连接已满,无法建立新的连接

查询当前所有连接的状态

select datname,pid,application_name,state from pg_stat_activity;
select datname,pid,application_name,state,query from pg_stat_activity;

查看当前连接数
select count(*) from pg_stat_activity

查看最大连接数
show max_connections
select setting from pg_settings where name = 'max_connections'

查看数据库剩余连接数
select max_conn - now_conn as resi_conn from (select setting::int8 as max_conn,(select count(*) from pg_stat_activity) as now_conn from pg_settings where name = 'max_connections') t;
查看为超级用户保留的连接数
show superuser_reserved_connections;

按照用户分组查看
select usename, count(*) from pg_stat_activity group by usename order by count(*) desc;

结束连接 
select pg_terminate_backend(pidxxx) 

结束 idle  的连接

select pg_terminate_backend(pid) from pg_stat_activity where state='idle'; 

select count(1) from pg_stat_activity where state='idle';

上一篇     下一篇
go 单引号 双引号 反引号

GO json 序列化与反序列化

protobuf3二进制数据转java对象

temporal 代码阅读记录

temporal namespace 信息获取 关键代码及堆栈信息

go.sum 生成