Virtual keyspaces and tables
Provides details about virtual keyspaces and tables.
CASSANDRA-7622 introduced support for virtual keyspaces and virtual
tables. Virtual tables are exposed by the server to the users as local tables. They are
read-only, but can sometime can support updates. Virtual tables are always part of a virtual
keyspaces. The two available virtual keyspaces described in this topic are
system_virtual_schema
and system_views
. These virtual tables
are not associated with physical files on disk, have no memtables or SSTables, and do not support
secondary indexes or materialized views; they are designed to expose server data such as
configuration or metrics in memory. Tip: See Virtual tables for SAI indexes and SSTables for details about the Storage Attached Indexing (SAI)
virtual tables that reside in the
system_views
keyspace.system_virtual_schema keyspace
The
system_virtual_schema
contains the information about the existing virtual
keyspaces and tables. It contains three virtual tables which expose the definitions of the named
data object:Column name | CQL type | Column type |
---|---|---|
keyspace_name | text | partition key |
Column name | CQL type | Column type |
---|---|---|
keyspace_name | text | partition key |
table_name | text | clustering key |
comment | text | regular |
Column Name | CQL Type | Column type |
---|---|---|
keyspace_name | text | partition key |
table_name | text | clustering key |
column_name | text | clustering key |
clustering_order | text | regular |
column_name_bytes | blob | regular |
position | int | regular |
type | text | regular |
system_views keyspace
System views expose information about the server internals. The
sstable_tasks
system view exposes the SSTable tasks that are currently running on the host:Column name | CQL type | Column type |
---|---|---|
keyspace_name | text | partition key |
table_name | text | clustering key |
task_id | uuid | clustering key |
kind | text | regular |
progress | bigint | regular |
total | bigint | regular |
unit | text | regular |
Tip: The remaining amount of work can be computer using
total -
progress AS remaining
in a SELECT
clause.Virtual tables and cqlsh
Virtual tables are exposed as local tables, so cqlsh will display data for the currently
connected host. To displace schema for virtual tables, use
DESCRIBE FULL SCHEMA
to return schema for both the real keyspaces and the virtual ones.Note: Users are not allowed to
create virtual keyspaces or virtual tables.
To see the schema for the virtual table
sstable_tasks
,
use:DESCRIBE TABLE system_views.sstable_tasks;
/*
Warning: Table system_views.sstable_tasks is a virtual table and cannot be recreated with CQL.
Structure, for reference:
VIRTUAL TABLE system_views.sstable_tasks (
keyspace_name text,
table_name text,
task_id uuid,
kind text,
progress bigint,
total bigint,
unit text,
PRIMARY KEY (keyspace_name, table_name, task_id)
) WITH CLUSTERING ORDER BY (table_name ASC, task_id ASC)
AND comment = 'current sstable tasks';
*/
To discover how much time is remaining for SSTable tasks, use the following
query:SELECT total - progress AS remaining FROM system_views.sstable_tasks;