select current_timestamp,cnt from (select count(*) as cnt from pg_stat_activity) \watch 10 1000000;
show max_connections;
查询出来为数据库最大连接数,默认2000
其次查询下面SQL,如果总和基本达到2000说明会话满了
select count(*),state from pg_stat_activity group by state order by 1 ;