Skip to content

Command reference

17 commands organized into six operational groups.

kbdiag provides 17 top-level commands grouped by operational workflow. Legacy command paths remain supported as hidden aliases without changing JSON compatibility.

Entry points

CommandQuestion / drill-down
statusFirst look: identity, role, connections and coverage
checkBounded nine-domain patrol; check --html ./patrol.html

Runtime & concurrency

CommandQuestion / drill-down
sessionsession <pid>; session waits
locklock <pid>; lock --tree; lock --table <table>
txnTransaction horizons and 2PC (--xact-warn, --prepared-warn)
progressRunning VACUUM, CREATE INDEX, CLUSTER, and CHECKPOINT phases

Workload

CommandQuestion / drill-down
sqlsql top; sql show --id=<int64>; cumulative statistics

Storage & objects

CommandQuestion / drill-down
spaceLocal filesystems, WAL, databases and tablespaces
objectobject summary; object table/index/seq [name]
vacuumCurrent-database dead tuples and autovacuum; --schema
freezeInstance database ages and current-database table ages

Persistence & writes

CommandQuestion / drill-down
walWAL position, volume and retention; wal archive
checkpointCheckpoint, bgwriter and backend write counters

Replication & server

CommandQuestion / drill-down
replLocal kernel streaming replication, sync state and lag
slotsPhysical/logical replication slots, retained WAL and xmin
clusterExternal repmgr topology; defaults to esrep
serverServer 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.