PostgreSQL操作随记
来自三线的随记
PostgreSQL默认用户: postgres
Connect
psql -h host -U user -W
连接数相关
配置文件
sed "s/max_connections = .*/max_connections = 1024/" /var/lib/postgresql/data/postgresql.conf|grep max_connection
sed -i "s/max_connections = .*/max_connections = 1024/" /var/lib/postgresql/data/postgresql.conf|grep max_connection
commands
临时修改连接数(待验证)
alter system set max_connections=1024
查看连接数
select count(1) from pg_stat_activity;
查看最大连接数值
show max_connections;
查看保留连接数
show superuser_reserved_connections;
查看连接的客户端信息
SELECT * FROM pg_stat_activity
keywords: PSQLException: FATAL: sorry, too many clients already