Lab 10 — Incident Diagnosis
Scenario
Instead of beginning with one query, you begin with database-wide signals. pg_stat_statements identifies cumulative workload, while pg_stat_activity shows what sessions are doing now.
Run the exercise
Investigate
- Separate high total time from high mean latency and high call count.
- Treat cumulative statistics as evidence with an unknown observation window unless reset time is known.
- Correlate active queries with state and wait events.
- Capture query IDs and representative plans before changing anything.
- Rank hypotheses and state what evidence would reject each one.
Diagnostic question
Which workload deserves investigation first, and how do you distinguish an expensive query from a frequently called query or a waiting session?