txn: open transactions, 2PC and XID horizons
Inspect open transactions, prepared 2PC transactions, and oldest xmin/xid vacuum horizon holders.
Identify long-running transactions, unfinished two-phase commits (2PC), and the session, 2PC, or replication slot holding back the vacuum horizon. Read-only: never commits, rolls back, or cancels transactions.
Usage
Key Options
| Option | Effect |
|---|---|
--xact-warn <sec> | WARN age threshold for open transactions (default 300s) |
--prepared-warn <sec> | WARN age threshold for prepared 2PC transactions (default 900s) |
--limit <N> | Max open-transaction rows rendered (0 unlimited; prepared 2PC rows remain unlimited and verdict evaluates all rows) |
--json | Emit structured JSON (session.activity, txn.prepared, slot.list, raw GIDs and XIDs) |
Verdict & Reading Output
WARN(exit=1):txn.long(open transaction age>= --xact-warn, default300s) ortxn.prepared(2PCage>= --prepared-warn, default900s).UNKNOWN(exit=3):session.activityunavailable/masked or primarytxn.preparedprobe failed.- Horizon & standby rules:
[OVERVIEW]comparesbackend_xid,backend_xmin,2PCXIDs, and slotxmintogether (tie-breaking in favor of actual transaction writers over snapshot retainers). On standbys,txn.preparedreportsnot_applicable; check2PCon the primary. Never commit or roll back a prepared2PCwithout checking its coordinator first.
Example (KES V9 Primary, --xact-warn 1 --prepared-warn 1, COLUMNS=80)
Related Commands
kbdiag session— inspect a long transaction PID’s current SQL and held lockskbdiag slots— inspect replication slots retainingxminorcatalog_xminkbdiag vacuum/kbdiag freeze— measure dead-tuple accumulation and XID age impact