Skip to main content
YCQL provides system tables through the system and system_schema keyspaces. These tables expose cluster metadata, peer information, and schema details compatible with Apache Cassandra drivers.

System Keyspace Tables

The system keyspace contains cluster topology and operational metadata.

system.local

Contains information about the local node that the client is connected to. This table always returns a single row.
ColumnTypeDescription
keytextPartition key, always “local”
bootstrappedtextBootstrap status (“COMPLETED”)
broadcast_addressinetPublic IP address of the node
cluster_nametextCluster name (“local cluster”)
cql_versiontextCQL version supported (“3.4.2”)
data_centertextData center name (from cloud_info)
gossip_generationintGossip generation (always 0)
host_iduuidUnique identifier for the node
listen_addressinetPrivate IP address of the node
native_protocol_versiontextNative protocol version (“4”)
partitionertextPartitioner class (“org.apache.cassandra.dht.Murmur3Partitioner”)
racktextRack/availability zone name
release_versiontextYugabyteDB version string
rpc_addressinetRPC address (public IP)
schema_versionuuidSchema version identifier
thrift_versiontextThrift version (“20.1.0”)
tokensset<text>Token ranges owned by this node
truncated_atmap<uuid, blob>Truncation timestamps by table
Example Query:
SELECT cluster_name, data_center, rack, release_version, host_id 
FROM system.local;
Connection Setup Query (Common Driver Pattern):
SELECT * FROM system.local WHERE key='local';

system.peers

Contains information about all peer nodes in the cluster (excludes the local node).
ColumnTypeDescription
peerinetPublic IP address of the peer (partition key)
data_centertextData center name
host_iduuidUnique identifier for the peer
preferred_ipinetPrivate IP address
racktextRack/availability zone name
release_versiontextYugabyteDB version string
rpc_addressinetRPC address (public IP)
schema_versionuuidSchema version identifier
tokensset<text>Token ranges owned by this peer
Example Query:
SELECT peer, data_center, rack, release_version, rpc_address 
FROM system.peers;
Topology Discovery (Driver Pattern):
SELECT peer, data_center, rack, release_version, rpc_address, tokens 
FROM system.peers;
YugabyteDB does not support system.peers_v2. Clients querying this table will receive an error directing them to use system.peers instead.

system.partitions

Provides tablet partition information for tables.
ColumnTypeDescription
keyspace_nametextKeyspace name
table_nametextTable name
start_keytextStart key of the partition range
end_keytextEnd key of the partition range
replica_addresseslist<inet>IP addresses of replicas
Example Query:
SELECT keyspace_name, table_name, start_key, end_key, replica_addresses 
FROM system.partitions;

System Schema Keyspace

The system_schema keyspace contains metadata about user-defined schema objects.

system_schema.keyspaces

Stores information about all keyspaces in the cluster.
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
durable_writesbooleanWhether durable writes are enabled
replicationmap<text, text>Replication strategy and options
Example Query:
SELECT keyspace_name, durable_writes, replication 
FROM system_schema.keyspaces;
Filter for User Keyspaces:
SELECT * FROM system_schema.keyspaces 
WHERE keyspace_name NOT IN ('system', 'system_schema', 'system_auth');

system_schema.tables

Contains metadata about all tables in the cluster.
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
table_nametextTable name (clustering key)
bloom_filter_fp_chancedoubleBloom filter false positive probability
cachingmap<text, text>Caching options
commenttextTable comment/description
compactionmap<text, text>Compaction strategy
compressionmap<text, text>Compression options
crc_check_chancedoubleCRC check probability
dclocal_read_repair_chancedoubleDC-local read repair chance
default_time_to_liveintDefault TTL in seconds
extensionsmap<text, blob>Extension metadata
flagsset<text>Table flags
gc_grace_secondsintGrace period for tombstone GC
iduuidUnique table identifier
max_index_intervalintMaximum index interval
memtable_flush_period_in_msintMemtable flush period
min_index_intervalintMinimum index interval
read_repair_chancedoubleRead repair probability
speculative_retrytextSpeculative retry policy
Example Query:
SELECT keyspace_name, table_name, id, default_time_to_live, comment 
FROM system_schema.tables;

system_schema.columns

Describes all columns for all tables.
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
table_nametextTable name (clustering key)
column_nametextColumn name (clustering key)
clustering_ordertextClustering order (“asc” or “desc”)
column_name_bytesblobColumn name as bytes
kindtextColumn kind (“partition_key”, “clustering”, “regular”, “static”)
positionintPosition in key (for key columns)
typetextCQL data type
Example Query:
SELECT keyspace_name, table_name, column_name, kind, type, position 
FROM system_schema.columns
WHERE keyspace_name = 'my_keyspace'
AND table_name = 'my_table';
Find Partition Keys:
SELECT keyspace_name, table_name, column_name, position
FROM system_schema.columns
WHERE kind = 'partition_key'
ALLOW FILTERING;

system_schema.indexes

Stores information about secondary indexes.
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
table_nametextBase table name (clustering key)
index_nametextIndex name (clustering key)
kindtextIndex kind (“COMPOSITES”)
optionsmap<text, text>Index options and target column
Example Query:
SELECT keyspace_name, table_name, index_name, options 
FROM system_schema.indexes;

system_schema.views

Contains metadata about materialized views.
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
view_nametextView name (clustering key)
base_table_iduuidID of the base table
base_table_nametextName of the base table
bloom_filter_fp_chancedoubleBloom filter false positive probability
cachingmap<text, text>Caching configuration
commenttextView comment
compactionmap<text, text>Compaction strategy
compressionmap<text, text>Compression options
crc_check_chancedoubleCRC check probability
dclocal_read_repair_chancedoubleDC-local read repair chance
default_time_to_liveintDefault TTL
extensionsmap<text, text>Extension metadata
gc_grace_secondsintTombstone grace period
iduuidUnique view identifier
include_all_columnsbooleanWhether all columns are included
max_index_intervalintMaximum index interval
memtable_flush_period_in_msintMemtable flush period
min_index_intervalintMinimum index interval
read_repair_chancedoubleRead repair probability
speculative_retrytextSpeculative retry policy
where_clausetextView WHERE clause filter
Example Query:
SELECT keyspace_name, view_name, base_table_name, where_clause 
FROM system_schema.views;

system_schema.types

Stores user-defined types (UDTs).
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
type_nametextType name (clustering key)
field_nameslist<text>Names of UDT fields
field_typeslist<text>Types of UDT fields
Example Query:
SELECT keyspace_name, type_name, field_names, field_types 
FROM system_schema.types;

system_schema.functions

Contains user-defined functions (currently a virtual table that may return no rows).
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
function_nametextFunction name
argument_typeslist<text>Input argument types
argument_nameslist<text>Input argument names
bodytextFunction body
called_on_null_inputbooleanWhether function is called on NULL input
languagetextImplementation language
return_typetextReturn data type
Example Query:
SELECT * FROM system_schema.functions;

system_schema.aggregates

Stores user-defined aggregates (currently a virtual table that may return no rows).
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
aggregate_nametextAggregate name
argument_typeslist<text>Input argument types
final_functextFinal transformation function
initcondtextInitial condition
return_typetextReturn data type
state_functextState transformation function
state_typetextState data type
Example Query:
SELECT * FROM system_schema.aggregates;

system_schema.triggers

Contains trigger definitions (currently a virtual table that may return no rows).
ColumnTypeDescription
keyspace_nametextKeyspace name (partition key)
table_nametextTable name
trigger_nametextTrigger name
optionsmap<text, text>Trigger options
Example Query:
SELECT * FROM system_schema.triggers;

Common Query Patterns

Cluster Topology Discovery

Get complete cluster topology information:
-- Local node information
SELECT data_center, rack, release_version, host_id 
FROM system.local WHERE key='local';

-- All peer nodes
SELECT peer, data_center, rack, release_version, host_id 
FROM system.peers;

Schema Version Consistency Check

Verify that all nodes have the same schema version:
-- Get local schema version
SELECT schema_version FROM system.local WHERE key='local';

-- Get peer schema versions
SELECT peer, schema_version FROM system.peers;

Table Schema Inspection

Retrieve complete schema for a table:
-- Table metadata
SELECT * FROM system_schema.tables 
WHERE keyspace_name = 'my_keyspace' 
AND table_name = 'my_table';

-- Column definitions
SELECT column_name, kind, type, position 
FROM system_schema.columns
WHERE keyspace_name = 'my_keyspace' 
AND table_name = 'my_table';

-- Indexes on the table
SELECT index_name, options 
FROM system_schema.indexes
WHERE keyspace_name = 'my_keyspace' 
AND table_name = 'my_table';

Keyspace Replication Analysis

Analyze replication configuration across keyspaces:
SELECT keyspace_name, replication 
FROM system_schema.keyspaces
WHERE keyspace_name NOT IN ('system', 'system_schema');

Data Center Distribution

Check node distribution across data centers:
-- Count by data center (requires manual aggregation)
SELECT data_center FROM system.local WHERE key='local';
SELECT data_center FROM system.peers;

Find All Tables with TTL

Identify tables with default TTL configured:
SELECT keyspace_name, table_name, default_time_to_live 
FROM system_schema.tables
WHERE default_time_to_live > 0
ALLOW FILTERING;

List Partition and Clustering Keys

-- Partition keys
SELECT keyspace_name, table_name, column_name, position
FROM system_schema.columns
WHERE kind = 'partition_key'
ALLOW FILTERING;

-- Clustering keys
SELECT keyspace_name, table_name, column_name, position, clustering_order
FROM system_schema.columns
WHERE kind = 'clustering'
ALLOW FILTERING;

Virtual Table Implementation

YugabyteDB implements system tables as virtual tables, meaning:
  • Data is computed dynamically from the master’s metadata
  • No physical storage is used for system tables
  • Queries against system tables are routed to the master leader
  • Performance is optimized for common driver connection patterns

Cached System Queries

YugabyteDB caches responses for frequently executed system queries to improve driver connection performance. Cached queries include:
  • SELECT * FROM system.local WHERE key='local'
  • SELECT * FROM system.peers
  • Schema discovery queries from system_schema tables
Caching behavior can be controlled with these flags:
  • cql_update_system_query_cache_msecs - Cache refresh interval
  • cql_system_query_cache_stale_msecs - Maximum cache staleness
  • cql_system_query_cache_empty_responses - Whether to cache empty responses

Compatibility Notes

Cassandra Compatibility

YugabyteDB’s YCQL system tables maintain compatibility with Apache Cassandra drivers:
  • Column names and types match Cassandra 3.x schema
  • Virtual tokens are generated for driver compatibility
  • Schema version UUIDs are consistent across nodes

Differences from Cassandra

  1. No system.peers_v2: YugabyteDB only supports system.peers
  2. Virtual tokens: Token values are computed dynamically, not stored
  3. Single-host system.local: Always returns one row for the connected node
  4. Schema propagation: Uses YugabyteDB’s catalog versioning instead of gossip
  5. Empty virtual tables: Some tables (functions, aggregates, triggers) may be empty if features are not yet implemented

See Also

Build docs developers (and LLMs) love