How to get locks present in PostgreSQL

In this article, we will see How to get locks present in PostgreSQL.

Query to check the locks present in PostgreSQL:

select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from pg_locks l, pg_stat_all_tables t where l.relation=t.relid order by relation asc;

Continue reading How to get locks present in PostgreSQL

Lock and Unlock PostgreSQL User

In this article, we are going Lock and Unlock PostgreSQL User. Privileges required to Lock and Unlock PostgreSQL User is ALTER USER.

Steps to Lock and Unlock PostgreSQL User:

1. Lock the user

ALTER USER anil NOLOGIN;

Continue reading Lock and Unlock PostgreSQL User