postgresql常用命令与查询

目录
  1. 配置
  2. 常用命令
  3. 常用查询

配置

修改最大连接数(Ubuntu, postgresql版本9.5)
postgresql配置文件 /etc/postgresql/9.5/main/postgresql.conf

1
max_connections = 100(默认100, 修改后需重启postgres)

常用命令

1
2
-- 重启
sudo service postgresql restart

常用查询

1
2
3
4
5
6
7
8
- 查看postgresql的连接数
select * from pg_stat_activity;

- 查看最大连接数限制
show max_connections;

- 查看为超级用户保留的连接数
show superuser_reserved_connections;