System Views
KalamDB exposes computed system.* views for metadata and runtime observability. This page focuses on the new session and transaction views added for explicit transaction support.
system.sessions
system.sessions shows active PostgreSQL gRPC bridge sessions tracked by the server.
It is intentionally pg-session-focused:
pg_kalamsessions appear here while they are active.- Native
/v1/api/sqlrequests do not create rows here. - The CLI
\sessionscommand runs this view directly.
Common query
SELECT *
FROM system.sessions
ORDER BY last_seen_at DESC, session_id;Active-transaction query
SELECT session_id, transaction_id, transaction_state, transaction_has_writes
FROM system.sessions
WHERE transaction_id IS NOT NULL
ORDER BY last_seen_at DESC, session_id;Columns
| Column | Meaning |
|---|---|
session_id | Server-side pg bridge session identifier. |
backend_pid | Parsed PostgreSQL backend PID when the session id uses the pg-<pid>-... form. |
current_schema | Current schema reported by the pg extension session. |
state | Session state, similar to PostgreSQL pg_stat_activity semantics. |
transaction_id | Active remote transaction id, if one is open. |
transaction_state | Current remote transaction lifecycle state. |
transaction_has_writes | Whether the active transaction has staged writes. |
client_addr | Observed client socket address for the gRPC session. |
transport | Transport used by the session. |
opened_at | When the server first observed the session. |
last_seen_at | Most recent RPC activity timestamp. |
last_method | Most recent gRPC method observed for the session. |
system.transactions
system.transactions shows active explicit transactions across all server origins.
Use it to observe transaction state regardless of whether the transaction came from pg_kalam or native KalamDB SQL.
- Common
originvalues includePgRpcfor the PostgreSQL extension andSqlBatchfor native/v1/api/sqlexecution. - Rows disappear immediately after
COMMIT,ROLLBACK, timeout cleanup, or request-end cleanup.
Common query
SELECT transaction_id, owner_id, origin, state, write_count
FROM system.transactions
ORDER BY origin, transaction_id;Capacity-oriented query
SELECT transaction_id, origin, state, age_ms, idle_ms, write_bytes, touched_tables_count
FROM system.transactions
ORDER BY age_ms DESC;Columns
| Column | Meaning |
|---|---|
transaction_id | Canonical explicit transaction identifier. |
owner_id | Human-readable owner identifier, such as a pg session id or request-scoped SQL owner id. |
origin | Source of the transaction, such as PgRpc or SqlBatch. |
state | Current lifecycle state. |
age_ms | Transaction age in milliseconds. |
idle_ms | Milliseconds since the transaction last performed work. |
write_count | Number of staged mutations currently buffered. |
write_bytes | Approximate in-memory size of the staged write set. |
touched_tables_count | Number of tables referenced by the transaction. |
snapshot_commit_seq | Committed snapshot boundary captured at BEGIN. |
Key Distinction
system.sessionsshows live PostgreSQL bridge sessions only.system.transactionsshows active explicit transactions across all supported origins.- A native
/v1/api/sqltransaction appears insystem.transactions, but not insystem.sessions.
Related
Last updated on