Lock Queue Triage

Untangle a live blocking chain in PostgreSQL or MySQL: find the head of the chain rather than the victims by walking pg_blocking_pids() to a session that is not itself blocked, or sys.innodb_lock_waits and performance_schema.metadata_locks on MySQL, cancel a waiting ALTER first because it queues every later reader, then deal with the real holder (usually idle in transaction), terminating only after recording pid, query, application_name and owner; then set lock_timeout, idle_in_transaction_session_timeout and log_lock_waits. Use for "everything is hanging on one table", "queries piled up behind an ALTER", "Waiting for table metadata lock", "who is blocking whom" or "lock wait timeout exceeded". Not for planning a safe schema change (db-migration), a deadlock the engine already broke (deadlock-analysis) or running the incident (incident-response).

greenblacked Updated
The twenty-nine plugins: coding, family, gamedev, operations, delivery, security, manager, personal, career, design, llm, data, techdocs, assurance, client-apps

File contents

greenblacked/AI commit 7d87f26c63

Frequently asked questions

npx get-skill add greenblacked/lock-queue-triage