PostgreSQL常用SQL语句
PostgreSQL与MySQL语法有一些细微差异,记录一下PostgreSQL常用的SQL语句。
1. 创建数据库、用户,并授予用户权限
create database test;
create user test with password 'test';
grant all privileges on database test to test;
grant all privileges on all tables in schema public to test;
2. 其他常用
# 统计当前所有连接数
select count(1) from pg_stat_activity;
# 查询当前连接数详细信息
select * from pg_stat_activity;
# 查询最大连接数
show max_connections;