adding postgresql
This commit is contained in:
parent
8bd61dd440
commit
89a8745430
28
postgresql/cli.md
Normal file
28
postgresql/cli.md
Normal file
@ -0,0 +1,28 @@
|
||||
### Get list of users and numbers of active connections
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
datname AS database_name,
|
||||
usename AS user_name,
|
||||
count(*) AS active_connections
|
||||
FROM pg_stat_activity
|
||||
GROUP BY datname, usename order by active_connections DESC;
|
||||
```
|
||||
|
||||
### Limit number of connections for user
|
||||
|
||||
```sql
|
||||
alter user keycloak connection limit 80;ALTER ROLE
|
||||
```
|
||||
|
||||
### Remove limit number of connections for user
|
||||
|
||||
```sql
|
||||
alter user keycloak connection limit -1;ALTER ROLE
|
||||
```
|
||||
|
||||
### Get replication status
|
||||
|
||||
```sql
|
||||
select * from pg_stat_replication;
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user