Command reference
kbdiag provides 17 top-level commands grouped by operational workflow. Legacy command paths remain supported as hidden aliases without changing JSON compatibility.
Entry points
| Command | Question / drill-down |
|---|---|
status | First look: identity, role, connections and coverage |
check | Bounded nine-domain patrol; check --html ./patrol.html |
Runtime & concurrency
| Command | Question / drill-down |
|---|---|
session | session <pid>; session waits |
lock | lock <pid>; lock --tree; lock --table <table> |
txn | Transaction horizons and 2PC (--xact-warn, --prepared-warn) |
progress | Running VACUUM, CREATE INDEX, CLUSTER, and CHECKPOINT phases |
Workload
| Command | Question / drill-down |
|---|---|
sql | sql top; sql show --id=<int64>; cumulative statistics |
Storage & objects
| Command | Question / drill-down |
|---|---|
space | Local filesystems, WAL, databases and tablespaces |
object | object summary; object table/index/seq [name] |
vacuum | Current-database dead tuples and autovacuum; --schema |
freeze | Instance database ages and current-database table ages |
Persistence & writes
| Command | Question / drill-down |
|---|---|
wal | WAL position, volume and retention; wal archive |
checkpoint | Checkpoint, bgwriter and backend write counters |
Replication & server
| Command | Question / drill-down |
|---|---|
repl | Local kernel streaming replication, sync state and lag |
slots | Physical/logical replication slots, retained WAL and xmin |
cluster | External repmgr topology; defaults to esrep |
server | Server summary; server params; server license |
Connection and exit codes
Use -h/--host, -p, -d, -U, -W/--password and --sslmode to specify the target instance (precedence: explicit CLI flag > KINGBASE_* > PG* > defaults; password via -W, KINGBASE_PASSWORD, PGPASSWORD or ~/.pgpass); use --help for command usage. --json emits machine-readable output.
Exit codes: 0 OK, 1 WARN, 2 FAIL, 3 UNKNOWN, 64 usage error, 69 connection failure.
Check instance version, role, replication, activity, license, connections and local disk.
Run a bounded read-only nine-domain health check and export a self-contained offline HTML report.
List active and blocking sessions, inspect one PID’s SQL and locks, or group current wait events.
Inspect lock waits, blocker trees, and DDL queue predecessors.
Inspect open transactions, prepared 2PC transactions, and oldest xmin/xid vacuum horizon holders.
Inspect running VACUUM, CREATE INDEX, CLUSTER / VACUUM FULL, and KES CHECKPOINT operations.
Rank cumulative SQL workload and inspect a signed queryid profile.
Check data/WAL/tablespace filesystem usage, WAL retention settings, database sizes, and tablespace capacities.
Inventory database objects by schema and inspect tables, indexes, and sequences.
Check dead tuples, autovacuum thresholds, running vacuums, and global switches in the current database.
Compare instance-wide database XID/MXID ages against freeze limits and list the oldest relations in the current database.
Check WAL LSN position, sys_wal directory size, retention blockers (slots, wal_keep_segments), and archiver health.
Inspect the last checkpoint/restartpoint, cumulative bgwriter/backend buffer writes, average rates, and checkpoint GUCs.
Check synchronous standby settings, downstream replication lag, and standby upstream/replay progress.
List replication slots, active PIDs, retained WAL bytes, xmin/catalog_xmin blockers, and inactive slot warnings.
Inspect repmgr nodes, local role match, synchronous config, and recent cluster events (defaults to database esrep).
Inspect full KES version/mode, changed and pending_restart parameters, and license expiry, MAC, and max connections.