# db-locks This command displays queries that have taken out an exclusive lock on a relation. Exclusive locks typically prevent other operations on that relation from taking place, and can be a cause of "hung" queries that are waiting for a lock to be granted. If you see a query that is hanging for a very long time or causing blocking issues you may consider killing the query by connecting to the database and running `SELECT pg_cancel_backend(PID);` to cancel the query. If the query still does not stop you can force a hard stop by running `SELECT pg_terminate_backend(PID);` ``` PID │ RELNAME │ TRANSACTION ID │ GRANTED │ QUERY │ AGE ─────────┼─────────┼────────────────┼─────────┼─────────────────────────────────────────┼─────────── 328112 │ null │ 0 │ t │ SELECT * FROM logs; │ 00:04:20 ```