Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

Cassandra Virtual Tables

Virtual tables expose Cassandra's internal state through standard CQL queries. They provide real-time access to metrics, configuration, cluster status, and operational information without requiring JMX or external tools.


Virtual tables are read-only tables that do not store data on disk. Instead, they generate results dynamically by querying Cassandra's internal state. Each query executes against the local node only—virtual tables do not coordinate across the cluster.

CharacteristicRegular TablesVirtual Tables
Data storageSSTables on diskNone (generated on query)
ScopeDistributed across clusterLocal to queried node
MutabilityRead/writeRead-only
ConsistencyConfigurable CLAlways local
ALLOW FILTERINGRequired for non-key filtersNot required
SchemaUser-definedSystem-defined
VersionVirtual Tables Feature
4.0Virtual tables introduced (CASSANDRA-7622). Initial tables for settings, thread pools, and clients.
4.1Additional metrics tables, improved repair tracking
5.0SAI index introspection tables, expanded repair state, streaming visibility (CEP-14)

Before virtual tables, accessing internal Cassandra state required JMX connections, which presented challenges:

  • JMX requires separate tooling and authentication
  • Firewall rules often block JMX ports
  • No standard query language for JMX
  • Difficult to integrate with existing CQL-based monitoring

Virtual tables solve these problems by exposing the same information through CQL.

Cassandra NodeInternal StateCQL LayerVirtual Table HandlerThread PoolsMetricsConfigurationCluster StateClient ApplicationNo disk I/ONo consistency coordinationLocal node onlySELECT * FROM system_views.thread_poolsReturn result setRoute to virtual tableFormat as rowsQuery internal stateReturn current values

Key characteristics:

  • Queries execute entirely on the coordinator node
  • Results reflect the state of that specific node only
  • No replication, no consistency levels, no tombstones
  • Each query generates fresh data from internal state

  • Results reflect the current state of the local node at query time
  • Queries never require ALLOW FILTERING warnings (safe to use without partition key)
  • Schema is stable within a major version
  • Virtual tables are always available when the node is running
  • Read operations have minimal overhead

Undefined Behavior

The following behaviors are undefined and must not be relied upon:

  • Cross-node consistency: Querying the same virtual table on different nodes returns different results (each node's local state)
  • Point-in-time snapshots: Virtual table contents may change between rows being returned if internal state changes during query
  • Schema stability across versions: Virtual table schemas may change between Cassandra versions
  • Complete metric accuracy: Some metrics are approximations or samples
  • Historical data: Virtual tables show current state only; historical data requires external collection
BehaviorDescription
Consistency LevelIgnored—always reads local node
TracingSupported but shows only local execution
PagingSupported for large result sets
Prepared StatementsSupported and recommended
ALLOW FILTERINGNot required—virtual tables are local-only

Cassandra 5.0 provides two virtual keyspaces:

KeyspacePurposeDocumentation
system_virtual_schemaMetadata about virtual tablesSchema Reference
system_viewsOperational tablesSee categories below
CategoryDescriptionDocumentation
MetricsLatency, read statistics, batch/CQL metricsMetrics Tables
Thread PoolsThread pool utilization and statusThread Pools
CachesCache hit rates and sizesCaches
ClientsConnected clients and active queriesClients
Cluster StateGossip, hints, internode communicationCluster State
StorageDisk usage, partitions, snapshots, tasksStorage
RepairRepair operation trackingRepair
SAI IndexesStorage-Attached Index introspectionSAI
StreamingData streaming operationsStreaming
ConfigurationRuntime settings and propertiesConfiguration

-- Thread pool health
SELECT name, active_tasks, pending_tasks, blocked_tasks
FROM system_views.thread_pools
WHERE pending_tasks > 0 OR blocked_tasks > 0;
-- Cache efficiency
SELECT name, hit_ratio, size_bytes, capacity_bytes
FROM system_views.caches;
-- Connected clients
SELECT address, username, driver_name, request_count
FROM system_views.clients;
-- Table latencies
SELECT keyspace_name, table_name, p99th_ms
FROM system_views.coordinator_read_latency;
-- Tombstone problems
SELECT keyspace_name, table_name, p99th, max
FROM system_views.tombstones_per_read
WHERE p99th > 100;
-- Alert: Blocked thread pools
SELECT name, blocked_tasks
FROM system_views.thread_pools
WHERE blocked_tasks > 0;
-- Alert: Low cache hit ratio (note: use lowercase 'keys', not 'KeyCache')
SELECT name, hit_ratio
FROM system_views.caches
WHERE name = 'keys' AND hit_ratio < 0.80;
-- Alert: Large pending hints
SELECT host_id, address, files
FROM system_views.pending_hints
WHERE files > 100;
-- Alert: Active repairs taking too long
SELECT id, keyspace_name, duration_millis
FROM system_views.repairs
WHERE completed = false AND duration_millis > 3600000;

Use virtual tables in monitoring systems instead of JMX where possible:

nodetool CommandVirtual Table Equivalent
nodetool tpstatssystem_views.thread_pools
nodetool gossipinfosystem_views.gossip_info
nodetool compactionstatssystem_views.sstable_tasks
nodetool clientstatssystem_views.clients
nodetool listsnapshotssystem_views.snapshots
nodetool listpendinghintssystem_views.pending_hints

Virtual tables are designed for monitoring queries, not high-frequency polling:

Use CaseRecommended Interval
Dashboard refresh30-60 seconds
Alerting checks60 seconds
Capacity planning5-15 minutes
Ad-hoc debuggingOn-demand

Virtual tables return local data only. To aggregate across the cluster, query each node:

# Example: Query all nodes
from cassandra.cluster import Cluster
cluster = Cluster(contact_points=['node1', 'node2', 'node3'])
for host in cluster.metadata.all_hosts():
session = cluster.connect()
# Execute on specific node
result = session.execute(
"SELECT * FROM system_views.thread_pools",
host=host
)
print(f"Node {host.address}: {list(result)}")

Virtual Table Restrictions

Cannot modify: Virtual tables are read-only. INSERT, UPDATE, DELETE operations fail.

Local scope only: Results reflect only the queried node. Cluster-wide views require querying each node.

No indexes: Cannot create secondary indexes on virtual tables.

No materialized views: Cannot create materialized views based on virtual tables.

Schema changes: Cannot ALTER virtual tables. Schema is fixed by Cassandra version.

No TTL/Timestamps: WRITETIME() and TTL() functions return null.