Lab 11 — Concurrency and Locks
Scenario
A slow request may be waiting rather than executing. This lab uses blocking relationships and wait events to distinguish lock delay from query-plan cost.
Run the exercise
Use at least two psql sessions to create and observe a controlled blocking case, then run:
Investigate
- Identify blocked and blocking process IDs.
- Inspect transaction state, query text, and wait-event type.
- Build the blocking chain rather than focusing only on the final waiter.
- Explain how long transactions and application behavior contribute.
- Prefer ending the controlled test transaction; do not terminate unrelated sessions.
Diagnostic question
Is latency caused by execution or waiting, and which session at the root of the blocking chain must be addressed?