session: active sessions, PID detail and wait summary
List active and blocking sessions, inspect one PID’s SQL and locks, or group current wait events.
Inspect live instance sessions from three angles: session (overview and active/blocking list), session <pid> (one session’s full SQL, waits, and locks), and session waits (wait-event distribution). Read-only: never terminates or cancels backends.
Usage
Key Options
| Option | Effect |
|---|---|
--app, --session-user, --session-db | Narrow displayed rows ([OVERVIEW] and JSON remain instance-wide) |
--state, --wait-type, --min-xact-age | Filter by session state (active/idle/idle-in-txn/waiting), wait type, or txn age |
--sort xact|query, --limit N, --wide | Control row sorting, display cap, and client/queryid columns |
Verdict & Reading Output
WARN(exit=1): Openidle in transactionsession>= 300s(--idle-in-txn-warn), or wait>= 10s(--lock-wait-warn) onsession <pid>.OK(exit=0): All visible sessions within configured thresholds.UNKNOWN(exit=3): Non-monitoring roles unable to read other sessions’ SQL/waits see[REDACTED]and visible counts rather than fake0activity.session <pid>/session waits:session <pid>labelsidle in transactionqueries[LAST SQL]and prints blocker jump commands;session waitsseparates idle background/walsenderloops from active waits.
Example (KES V9 Primary, excerpt, COLUMNS=80)
Related Commands
kbdiag lock— expand the full blocking hierarchy and DDL queue predecessorskbdiag txn— inspect long open transactions and prepared2PChorizonskbdiag sql— trace aqueryidfromsession --wideinto cumulative statistics