0
点赞
收藏
分享

微信扫一扫

pg连接数资料

查询当前连接数

select count(1) from pg_stat_activity;

查询最大连接数设置

show max_connections;

最大连接数也可以在pg配置文件中配置:

在postgresql.conf中设置:

max_connections = 500

清理连接

查看过期连接
select * from pg_stat_activity where state = 'idle'
 
清理会话,传入pid
select pg_terminate_backend(2200);
 
查看最大连接数设置
show max_connections;
 
修改最大连接数,需要superuser权限
alter system set max_connections= 2000;

举报

相关推荐

0 条评论