Storage
The storage virtual tables provide visibility into disk usage, partition sizes, snapshots, and running SSTable operations like compaction.
disk_usage
Section titled “disk_usage”Shows disk space used per table on this node.
Schema
Section titled “Schema”VIRTUAL TABLE system_views.disk_usage ( keyspace_name text, table_name text, mebibytes bigint, PRIMARY KEY ((keyspace_name, table_name)))| Column | Type | Description |
|---|---|---|
keyspace_name | text | Keyspace name |
table_name | text | Table name |
mebibytes | bigint | Disk space used (MiB) |
Example Queries
Section titled “Example Queries”-- Disk usage by tableSELECT keyspace_name, table_name, mebibytesFROM system_views.disk_usage;
-- Tables over 10 GB (10240 MiB)SELECT keyspace_name, table_name, mebibytesFROM system_views.disk_usageWHERE mebibytes > 10240;max_partition_size
Section titled “max_partition_size”Shows the largest partition size per table. Critical for identifying oversized partitions.
Schema
Section titled “Schema”VIRTUAL TABLE system_views.max_partition_size ( keyspace_name text, table_name text, mebibytes bigint, PRIMARY KEY ((keyspace_name, table_name)))| Column | Type | Description |
|---|---|---|
keyspace_name | text | Keyspace name |
table_name | text | Table name |
mebibytes | bigint | Largest partition size (MiB) |
Example Queries
Section titled “Example Queries”-- Tables with large partitionsSELECT keyspace_name, table_name, mebibytesFROM system_views.max_partition_sizeWHERE mebibytes > 100;Large Partition Impact
| Size | Status | Impact |
|---|---|---|
| < 100 MiB | Normal | Healthy |
| 100-500 MiB | Warning | May cause GC pressure, slow repairs |
| 500 MiB - 1 GiB | Critical | Performance degradation likely |
| > 1 GiB | Severe | Requires data model redesign |
max_sstable_size
Section titled “max_sstable_size”Shows the largest SSTable size per table.
Schema
Section titled “Schema”VIRTUAL TABLE system_views.max_sstable_size ( keyspace_name text, table_name text, mebibytes bigint, PRIMARY KEY ((keyspace_name, table_name)))Example Queries
Section titled “Example Queries”-- Tables with large SSTablesSELECT keyspace_name, table_name, mebibytesFROM system_views.max_sstable_sizeWHERE mebibytes > 1000;max_sstable_duration
Section titled “max_sstable_duration”Shows the age of the oldest SSTable per table. Useful for identifying compaction issues.
Schema
Section titled “Schema”VIRTUAL TABLE system_views.max_sstable_duration ( keyspace_name text, table_name text, max_sstable_duration bigint, PRIMARY KEY ((keyspace_name, table_name)))| Column | Type | Description |
|---|---|---|
max_sstable_duration | bigint | Age of oldest SSTable (milliseconds) |
Example Queries
Section titled “Example Queries”-- Tables with old SSTables (potential compaction issues)SELECT keyspace_name, table_name, max_sstable_duration / 86400000 AS days_oldFROM system_views.max_sstable_durationWHERE max_sstable_duration > 604800000; -- > 7 daysOld SSTables
Old SSTables may indicate:
- Compaction falling behind
- TWCS windows not expiring
- Data written once and never updated
snapshots
Section titled “snapshots”Lists all snapshots on this node with size information.
Schema
Section titled “Schema”VIRTUAL TABLE system_views.snapshots ( name text, keyspace_name text, table_name text, created_at timestamp, ephemeral boolean, expires_at timestamp, size_on_disk bigint, true_size bigint, PRIMARY KEY (name, keyspace_name, table_name)) WITH CLUSTERING ORDER BY (keyspace_name ASC, table_name ASC)| Column | Type | Description |
|---|---|---|
name | text | Snapshot name |
keyspace_name | text | Keyspace |
table_name | text | Table |
created_at | timestamp | Creation timestamp |
true_size | bigint | Actual data size (bytes) |
size_on_disk | bigint | Disk space used (may differ due to hardlinks) |
expires_at | timestamp | Auto-expiration time (if TTL set) |
ephemeral | boolean | Auto-cleanup snapshot |
Equivalent nodetool command: nodetool listsnapshots
Example Queries
Section titled “Example Queries”-- All snapshotsSELECT name, keyspace_name, table_name, created_at, true_sizeFROM system_views.snapshots;Filter by created_at in application to find old snapshots for cleanup.
sstable_tasks
Section titled “sstable_tasks”Shows currently running SSTable operations (compaction, cleanup, scrub, etc.).
Schema
Section titled “Schema”VIRTUAL TABLE system_views.sstable_tasks ( keyspace_name text, table_name text, task_id timeuuid, completion_ratio double, kind text, progress bigint, total bigint, sstables int, target_directory text, unit text, PRIMARY KEY (keyspace_name, table_name, task_id)) WITH CLUSTERING ORDER BY (table_name ASC, task_id ASC)| Column | Type | Description |
|---|---|---|
keyspace_name | text | Keyspace |
table_name | text | Table |
task_id | timeuuid | Unique task identifier |
kind | text | Operation type (lowercase: compaction, cleanup, scrub, etc.) |
progress | bigint | Bytes/rows processed |
total | bigint | Total bytes/rows to process |
completion_ratio | double | Progress percentage (0.0-1.0) |
sstables | int | Number of SSTables involved |
unit | text | Unit of progress (bytes, keys, etc.) |
target_directory | text | Output directory |
Equivalent nodetool command: nodetool compactionstats
Example Queries
Section titled “Example Queries”-- All running tasksSELECT keyspace_name, table_name, kind, completion_ratio, sstablesFROM system_views.sstable_tasks;
-- Compaction progress (note: kind values are lowercase)SELECT keyspace_name, table_name, kind, progress, total, completion_ratio * 100 AS percent_completeFROM system_views.sstable_tasksWHERE kind = 'compaction';
-- Large compaction operationsSELECT keyspace_name, table_name, sstables, total / 1073741824 AS total_gbFROM system_views.sstable_tasksWHERE total > 10737418240; -- > 10 GBAlerting Rules
Section titled “Alerting Rules”Large Partitions
Section titled “Large Partitions”-- Alert: Partitions exceeding thresholdSELECT keyspace_name, table_name, mebibytesFROM system_views.max_partition_sizeWHERE mebibytes > 100;Old Snapshots
Section titled “Old Snapshots”-- Alert: Snapshots older than 7 daysSELECT name, created_atFROM system_views.snapshotsWHERE created_at < toTimestamp(now()) - 604800s;Stalled Compactions
Section titled “Stalled Compactions”-- Alert: Long-running compactions (> 1 hour with < 50% progress)-- Requires application logic to track over timeSELECT keyspace_name, table_name, kind, completion_ratioFROM system_views.sstable_tasksWHERE kind = 'compaction';Disk Usage Growth
Section titled “Disk Usage Growth”-- Current disk usage for trendingSELECT keyspace_name, table_name, mebibytesFROM system_views.disk_usage;Monitoring Dashboard Query
Section titled “Monitoring Dashboard Query”-- Disk usage by tableSELECT keyspace_name, table_name, mebibytesFROM system_views.disk_usage;
-- Largest partitions by tableSELECT keyspace_name, table_name, mebibytesFROM system_views.max_partition_size;
-- Largest SSTables by tableSELECT keyspace_name, table_name, mebibytesFROM system_views.max_sstable_size;Filter out system keyspaces in application if needed.
Related Documentation
Section titled “Related Documentation”- Virtual Tables Overview - Introduction to virtual tables
- Metrics Tables - Performance metrics
- Backup & Restore - Snapshot procedures
- Compaction - Compaction tuning