Conceptual
Login

See What a Session Is Waiting On: the Activity View and Its wait_event Column

pg_stat_activity is the live list of every session the PostgreSQL server has: its state (active, idle, idle in transaction), the statement it is running, how long it has been running, and what it is currently waiting on in wait_event_type and wait_event. Ordering by how long a query has been running and reading the wait column tells you in one query whether the server is busy working, blocked on a lock, or waiting for I/O. MySQL's equivalent starting point is SHOW PROCESSLIST or the performance_schema thread views.

Questions this Concept answers

  • Why do the `wait_event_type` and `wait_event` columns change what you do next about a slowdown?