Analyze lock hotspots
analyze_lock_hotspotsRank PostgreSQL lock wait events by dominance and identify root causes—contention, high wait time, or high wait count—without modifying state.
Instructions
Rank PG 19 pg_stat_lock rows by wait dominance and surface stable reason codes. Read-only — never modifies state. Pair with find_blocking_chains for the active culprits on a specific hot lock_type. Returns an object with available (bool), server_version_num, detail, and hotspots — a list of objects with lock_type, waits, wait_time_us, reason (one of contention_dominant / high_wait_time / high_wait_count / low_contention), and suggested_followup (a human-readable next-step string).
Example: analyze_lock_hotspots()
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | Yes | ||
| hotspots | Yes | ||
| available | Yes | ||
| server_version_num | Yes |