ClickhouseDisk Space

Disk Space Management

ClickHouse can store massive amounts of data efficiently thanks to its columnar storage and compression. UptimeDock provides detailed disk space monitoring at the server, database, and table levels, helping you manage storage and plan for growth.

Overview

Disk space monitoring in UptimeDock gives you visibility into:

  • Overall disk usage and capacity
  • Per-database storage breakdown
  • Per-table disk usage with compression statistics
  • Parts count for merge optimization insights
Critical Resource

Running out of disk space can cause data loss and server instability. Set up alerts well before reaching capacity limits (recommended: alert at 75-80% usage).

Disk Dashboard

The Disk tab provides a quick overview of your ClickHouse server's storage status. Data is refreshed periodically (shown as "X minutes ago received").

Disk Metrics Explained

MetricDescriptionWhat to Watch
Total CapacityTotal disk space available to ClickHouseBaseline for usage calculations
UsedAmount of disk space currently in usePrimary growth indicator
FreeAvailable disk space remainingLow values indicate urgent action needed
Usage %Percentage of total capacity in usePrimary alert metric; watch for values above 75%
DatabasesNumber of databases on this serverUseful for multi-tenant environments
TablesTotal number of tables across all databasesHigh counts may indicate schema sprawl
RowsTotal row count across all tablesData volume indicator (displayed in M/B format)
Color Indicators

Usage percentage is color-coded: green for healthy, yellow/orange for warning, and red for critical levels.

Databases View

Switch to the Databases tab to see storage breakdown by database. This helps identify which databases consume the most space.

Understanding Database Columns

ColumnDescription
DatabaseName of the database. Click the eye icon for detailed view.
Total RowsTotal number of rows across all tables in this database.
Disk SizeActual disk space used by this database (compressed).
CompressionCompression ratio achieved (e.g., 6.57x means data is stored at 1/6.57 of original size).
TablesNumber of tables in this database.
PartsTotal data parts across all tables. High counts may indicate merge issues.

Use the search box to filter databases by name. Click Show Settings for additional filtering options.

System Database

The system database contains ClickHouse's internal tables like query_log, part_log, and text_log. These can grow large and should be monitored separately.

Tables View

The Tables tab shows storage for individual tables, sorted by size. This is essential for identifying which tables consume the most space.

Understanding Table Columns

ColumnDescription
TableFull table name in database.table format.
Total RowsNumber of rows in this table.
Disk SizeCompressed size on disk.
PartsNumber of data parts. Many parts can slow down queries.
% of TotalThis table's percentage of total disk usage.

Common large tables in a typical ClickHouse installation include:

  • system.text_log – Server text logs
  • system.query_log – Query execution history
  • system.part_log – Part merge/mutation history
  • system.processors_profile_log – Query processor profiling
System Tables Growth

System log tables can consume significant space over time. Consider setting TTL (Time To Live) policies to automatically clean old data:

-- Set TTL to keep only 30 days of query logs
ALTER TABLE system.query_log
MODIFY TTL event_date + INTERVAL 30 DAY;

-- Check current TTL settings
SELECT database, table, engine, partition_key
FROM system.tables
WHERE database = 'system' AND name LIKE '%log%';

Charts View

The Charts tab provides visual representations of disk usage trends over time. Use this to:

  • Identify growth patterns
  • Predict when you'll need more storage
  • Correlate disk usage with specific events

Setting Up Disk Alerts

Click the Alerts button to configure disk space notifications. You can set alerts at different levels:

Alert LevelThresholdAction
Warning75%Start planning capacity expansion or cleanup
Critical90%Immediate action required to prevent data loss
Pro Tip

The All Alerts button (with badge count) shows all active alerts across Disk and Memory metrics in one place.

Capacity Planning

Use disk monitoring data to plan for future storage needs:

  1. Track growth rate – Monitor how much data is added daily/weekly
  2. Estimate runway – Calculate how long until you reach capacity
  3. Plan ahead – Scale storage before hitting 80% usage
-- Calculate data growth rate
SELECT
    toStartOfDay(event_date) AS day,
    formatReadableSize(sum(bytes_on_disk)) AS daily_size
FROM system.parts
WHERE event_date >= today() - 30
GROUP BY day
ORDER BY day;

-- Estimate days until disk full
SELECT
    formatReadableSize(free_space) AS free,
    formatReadableSize(total_space) AS total,
    round(free_space / (total_space - free_space) * 30, 0) AS days_at_current_rate
FROM system.disks
WHERE name = 'default';

Troubleshooting

Common disk space issues and solutions:

IssueCauseSolution
Rapid disk growthHigh data ingestion or system logsSet TTL policies; check for unexpected data sources
High parts countMany small inserts; slow mergesBatch inserts; check merge settings; run OPTIMIZE TABLE
Low compression ratioRandom data; poor column orderingReorder columns; use appropriate codecs
system.* tables too largeNo TTL; high logging verbositySet TTL on system tables; adjust log level
Disk nearly fullUnexpected growth or missed alertsDrop old partitions; move data to cold storage; expand disk
-- Find tables with too many parts (potential merge issues)
SELECT
    database,
    table,
    count() AS parts_count,
    formatReadableSize(sum(bytes_on_disk)) AS size
FROM system.parts
WHERE active = 1
GROUP BY database, table
HAVING parts_count > 100
ORDER BY parts_count DESC;

-- Optimize a specific table (force merge)
OPTIMIZE TABLE database.table_name FINAL;

Best Practices

Storage Management Tips
  • Set TTL policies on all log tables to automatically clean old data
  • Monitor parts count – keep it under 100 per table for optimal performance
  • Use partitioning to easily drop old data
  • Review compression ratios – low ratios may indicate optimization opportunities
  • Set alerts at 75% usage to allow time for remediation

Recommended TTL settings for system tables:

-- Keep query_log for 14 days
ALTER TABLE system.query_log MODIFY TTL event_date + INTERVAL 14 DAY;

-- Keep text_log for 7 days
ALTER TABLE system.text_log MODIFY TTL event_date + INTERVAL 7 DAY;

-- Keep part_log for 30 days
ALTER TABLE system.part_log MODIFY TTL event_date + INTERVAL 30 DAY;
Related Documentation

For memory monitoring, see Memory & Resources. For query optimization, see Query Performance Monitoring.