本文内容记录PostgreSQL一些基本命令

命令行登陆数据库操作

 psql -h pgm   -p 3433 -U rooot -d uat

查看数据库剩余连接数

select max_conn-now_conn as resi_conn from (select setting::int8 as max_conn,(select count(*) from pg_stat_activity) as now_conn from pg_settings where name = 'max_connections') t;

查看replication情况

select * from pg_stat_replication;

查看槽位Slot

select * from pg_replication_slots;