4

查看PostgreSQL最大连接数信息

 2 years ago
source link: https://blog.51cto.com/abcd/5644467
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

1.查看当前配置的最大连接数

-- 查看当前配置的最大连接数
show max_connections;
查看PostgreSQL最大连接数信息_PostgreSQL

2.查询当前活跃连接数

-- 查询当前活跃连接数
select count(1) from pg_stat_activity;
查看PostgreSQL最大连接数信息_PostgreSQL_02

3.查看指定IP的活跃连接信息

-- 查看指定IP的活跃连接信息
select
*
from
pg_stat_activity
where
client_addr = '192.168.68.244';
查看PostgreSQL最大连接数信息_PostgreSQL_03

4.按IP地址查询当前活跃的连接数

-- 按IP地址查询当前活跃的连接数
select
client_addr, count(1) num
from
pg_stat_activity
group by
client_addr
order by
num desc;
查看PostgreSQL最大连接数信息_PostgreSQL_04

5.按用户查询当前活跃的连接数

-- 按用户查询当前活跃的连接数
select
usename, count(1) num
from
pg_stat_activity
group by
usename
order by
num desc;
查看PostgreSQL最大连接数信息_PostgreSQL_05

6.完整SQL文件信息

-- 1.查看当前配置的最大连接数
show max_connections;

-- 2.查询当前活跃连接数
select count(1) from pg_stat_activity;

-- 3.查看指定IP的活跃连接信息
select * from pg_stat_activity where client_addr = '192.168.68.244';

-- 4.按IP地址查询当前活跃的连接数
select client_addr, count(1) num from pg_stat_activity group by client_addr order by num desc;

-- 5.按用户查询当前活跃的连接数
select usename, count(1) num from pg_stat_activity group by usename order by num desc;

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK