Loading...
Loading...
Analyze ClickHouse table structure, partitioning, ORDER BY keys, materialized views, and identify schema design anti-patterns. Use for table design issues and optimization.
npx skill4agent add altinity/skills altinity-expert-clickhouse-schemaselect
database,
table,
count() as partitions,
sum(rows) as total_rows,
formatReadableSize(sum(bytes_on_disk)) as total_size,
formatReadableSize(median(bytes_on_disk)) as median_partition_size,
min(partition) as oldest_partition,
max(partition) as newest_partition
from system.parts
where active and database = '{database}' and table = '{table}'
group by database, table, partition
order by partition desc
limit 100select
name,
type,
formatReadableSize(data_compressed_bytes) as compressed,
formatReadableSize(data_uncompressed_bytes) as uncompressed,
round(data_uncompressed_bytes / nullIf(data_compressed_bytes, 0), 2) as ratio,
compression_codec
from system.columns
where database = '{database}' and table = '{table}'
order by data_compressed_bytes desc
limit 50select
database,
table,
name as index_name,
type,
expr,
granularity
from system.data_skipping_indices
where database = '{database}'
order by database, table| Data Volume | Recommended Granularity | Example |
|---|---|---|
| < 10GB/month | No partitioning or yearly | |
| 10-100GB/month | Monthly | |
| 100GB-1TB/month | Weekly or daily | |
| > 1TB/month | Daily | |
tenant_idregion| Data Type | Recommended Codec |
|---|---|
| Integers (sequential) | |
| Integers (random) | |
| Floats | |
| Timestamps | |
| Strings (long) | |
| Strings (repetitive) | |
| Finding | Load Module | Reason |
|---|---|---|
| Many small partitions | | Check batch sizing |
| Oversized partitions | | Merge can't complete |
| High PK memory | | Memory pressure |
| MV performance issues | | Query analysis |
| Too many parts per partition | | Merge backlog |
| Setting | Default | Recommendation |
|---|---|---|
| 8192 | Lower for point lookups, higher for scans |
| 0 | Set to 1 if TTL deletes entire partitions |
| 10MB | Increase if many small parts |