Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

Troubleshooting scenarios

Follow lock chains and distinguish active SQL from cumulative workload.

Start with kbdiag status and kbdiag check. Verify target identity, coverage and node role, then follow one diagnostic chain.

Storage and horizon investigations continue through space, wal archive, slots, vacuum, freeze and object table [name]. No scenario triggers automatic repair.

1 - Investigate lock waits

Find blockers, queued DDL predecessors and the transaction owner.

Find the chain

Use lock --tree first to see the full dependency hierarchy before narrowing to one PID or table. A queued DDL request can delay later queries before it holds its requested lock, and a direct blocker is not always the root holder.

kbdiag lock --tree
kbdiag lock <pid>
kbdiag lock --table public.orders
kbdiag session <pid>
kbdiag txn

Snapshots can change between commands. --table and <pid> filter displayed chains while [GLOBAL FINDINGS] still evaluates all collected lock rows; blocker edge resolution itself is capped globally at 50 waiting PIDs. Cross-database lock OIDs are not resolved against tables in other databases.

Inspect the owner

session <pid> displays full SQL (or [LAST SQL] when idle in transaction), waits, held/requested locks, and transaction age. idle in transaction shows an open transaction, not proof that it blocks anyone. Check txn for aged open transactions or prepared 2PC transactions that can hold locks after their session closes.

Verify before acting

Without monitoring privileges (sys_monitor), SQL for other users is masked; where wait-start timestamps are unavailable (such as versions relying on state_change), wait durations can also be hidden and yield UNKNOWN (while V9 sys_locks.waitstart may still expose wait duration even with SQL redacted). Coordinate with the application or transaction owner before committing, rolling back, or cancelling a backend; kbdiag never executes session termination.

Lock evidence and rules · Session evidence · Transaction horizons

2 - Investigate slow SQL

Separate instantaneous waits, cumulative counters and active query identity.

Separate now from history

session waits shows what is waiting right now; session identifies active PIDs. sql top ranks cumulative sys_stat_statements workload since the last reset—it does not prove a query is slow at this exact second. Review calls, mean, max, and total together.

kbdiag session waits
kbdiag session
kbdiag sql top --by=time
kbdiag sql top --by=calls --sql-db=test --sql-user=system
kbdiag sql show --id=<signed-int64> --sql-db=test --sql-user=system
kbdiag session <pid>

Statement queryid values are signed 64-bit integers and can be negative; always pass negative values via --id=<negative> or after --. --sql-db and --sql-user filter statement metrics, while -d and -U choose the database connection.

Match identity and capability

Keep (dbid, userid, queryid) distinct—the same queryid under two users or databases represents separate entries. On KES V9, sql show matches active sessions sharing sys_stat_activity.queryid; on kernels without sys_stat_activity.queryid (such as KES V8R6), sql show reports active matching as unavailable (UNKNOWN) rather than falsely claiming zero matches. SQL text similarity alone is never treated as an identity match.

Follow the bottleneck

Continue with lock --tree for Lock waits, progress for long maintenance operations, or space/wal for heavy temp-block or I/O activity. When statement statistics are missing, or track=none returns zero retained rows, kbdiag reports UNKNOWN/skipped (retained historical rows remain readable as OK with a track=none note) without modifying parameters or enabling extensions. kbdiag never runs automatic EXPLAIN.

SQL workload reference · Session reference