pg_lockwatch
pg_lockwatch · Sample blocking chains and score lock-contention risk
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101978 | pg_lockwatch | pg_lockwatch | 0.1.0 | STAT | Rust |
PostgreSQL · 15, 16, 17, 18
Usage
Sources:
pg_lockwatch samples blocking backends and wait chains, estimates lock-contention risk, and emits alerts. The reviewed 0.1.0 source is experimental; its scores are monitoring signals, not predictions with a proven accuracy guarantee.
Core Workflow
Add pg_lockwatch to shared_preload_libraries, select the worker database using lockwatch.database, and restart PostgreSQL. Install as a superuser in that database.
Configuration
lockwatch.sample_interval_ms sets the sampling interval and lockwatch.risk_threshold sets the alert threshold. Weights include lockwatch.weight_velocity, lockwatch.weight_duration, lockwatch.weight_lock_mode, and lockwatch.weight_cascade_depth. A notification is also recorded in the history table. The documented release workflow targets PostgreSQL 15–18.
Limits
Shared-memory arrays have a compiled capacity; raising lockwatch.max_tracked_blockers or lockwatch.history_window cannot enlarge them. Fingerprints hash raw query text rather than normalized queries. Duration baselines start with the first observed blocker, and lockwatch_history.resolved_as is not back-filled.
Upstream asks users to validate live integration before real workloads. No license file or Cargo license declaration was found in the reviewed revision; do not infer redistribution permission from public source visibility.