0

I found this sql for analyze locks in DB.

https://wiki.postgresql.org/wiki/Lock_Monitoring

But it shows me locks only on 1 DB, but there are a lot of DBs, so this is not working 100% full.

I found this information.

pg_locks provides a global view of all locks in the database cluster, not only those relevant to the current database. Although its relation column can be joined against pg_class.oid to identify locked relations, this will only work correctly for relations in the current database (those for which the database column is either the current database's OID or zero).

How can I get output for all locks of all DBs?

Thanks.

3
  • The page you link to has many SQL statements. But they will all show locks for all databases. Perhaps your user does not have permission to see queries by different users. – Laurenz Albe Jun 9 at 13:51
  • @LaurenzAlbe I am running this SQL as postgres (root) user, so this is not reason. – genderbee Jun 9 at 15:02
  • Then there are no other locks. You don't provide any code nor the results you get, so it is hard to judge. – Laurenz Albe Jun 9 at 15:14

Browse other questions tagged or ask your own question.