Skip to main content
View rawEdit

04. Wait event analysis (Active Session History)

Understand what your database is waiting on. This dashboard provides functionality similar to AWS RDS Performance Insights and Google CloudSQL Query Insights.

When to use

  • Active sessions are high and you need to identify the bottleneck
  • You suspect IO or lock pressure
  • The Node overview ASH panel shows unusual wait patterns
  • You need to correlate waits with specific queries

Key panels

  • Wait class distribution over time — stacked area chart showing CPU, IO, Lock, Client, and other wait types
  • Top waits by time — ranked list of specific wait events consuming the most time
  • Active sessions by wait type — current session distribution across wait categories

Wait event types

Wait typeMeaningCommon causes
CPUProcessing queriesExpected for compute-heavy workloads
IOReading/writing to diskUndersized shared_buffers, missing indexes, large sequential scans
LockWaiting for locksConcurrent updates to same rows, long transactions holding locks
ClientWaiting for clientIdle-in-transaction sessions, slow application, network latency
LWLockLightweight locksContention on internal Postgres structures, heavy WAL generation
BufferPinBuffer pin waitsConcurrent access to same buffers, can indicate hot spots

What good looks like

  • CPU is the dominant wait type (means the database is doing useful work)
  • Lock waits are rare and short-lived
  • IO waits are low — most data is served from the buffer cache
  • Client waits are minimal (no sessions stuck idle-in-transaction)

What to investigate

SignalNext step
Lock waits dominateGo to Lock contention to find blocking queries
IO waits dominateCheck storage performance, shared_buffers size, and query plans (missing indexes causing seq scans)
LWLock (WALWriteLock)Check WAL generation rate in Node overview; consider synchronous_commit = off for non-critical data
Client waits highLook for idle-in-transaction sessions; set idle_in_transaction_session_timeout
  • G001 — memory-related settings (CLI)
  • A003 — Postgres settings (CLI)
  • N001 — wait events grouped by type and query (monitoring stack)