全栈开发
数据库
【Q222】数据库中如何查看当前的连接数

数据库中如何查看当前的连接数

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 223 (opens in a new tab)

Author 回答者: shfshanyue (opens in a new tab)

PostgresSQL 的最大连接数与当前连接数

-- 最大连接数
show max_connections;
 
-- 当前连接数
select count(*) from pg_stat_activity;

mysql 的最大连接数与当前连接数

-- 最大连接数
show variables like 'max_connections';
 
-- 当前连接数
show full processlist;