List Current PostgreSQL Locks
pg_list_locksRetrieve currently active database locks to identify contention, deadlocks, and blocked queries. Optionally include granted locks and choose output format.
Instructions
Show currently active locks in the database, including waiting queries.
Useful for debugging lock contention, deadlocks, and long-running transactions.
Args:
include_granted: Include granted locks (not just waiting) — default: true
response_format: Output format
Returns: JSON: { locks: LockInfo[], blocking_pairs: [{blocker_pid, blocked_pid}] } Markdown: lock table with PID, query, lock type, relation, and wait status
Note: Requires sufficient privileges to view pg_stat_activity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_granted | No | Include already-granted locks (not just blocked) | |
| response_format | No | Output format: 'markdown' for human-readable, 'json' for machine-readable | markdown |