| name | clickhouse-cost-tuning |
| description | Optimize ClickHouse Cloud costs — compute scaling, storage tiering, compression,
and query efficiency for lower bills.
Use when analyzing ClickHouse Cloud bills, reducing storage costs, or optimizing
compute utilization.
Trigger with "clickhouse cost", "clickhouse billing", "reduce clickhouse spend",
"clickhouse pricing", "clickhouse expensive", "clickhouse storage cost".
|
| allowed-tools | Read |
| version | 1.7.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","database","analytics","clickhouse","olap"] |
| compatibility | Designed for Claude Code |
ClickHouse Cost Tuning
Overview
Reduce ClickHouse Cloud costs through storage optimization, compression tuning,
TTL policies, compute scaling, and query efficiency improvements. This skill walks
the bill from top driver to fix: identify what you actually pay for, then apply the
codec, TTL, compute, and query changes that move the number.
Deep copy-paste queries for every step live in
references/implementation.md; end-to-end scenarios
live in references/examples.md.
Prerequisites
- ClickHouse Cloud account with billing access
- Understanding of current data volumes and query patterns
Instructions
Step 1: Understand what you pay for
ClickHouse Cloud bills on four axes — and the biggest one is usually compute,
not storage, because ClickHouse compresses data 10-20x.
| Component | Pricing Model | Key Driver |
|---|
| Compute | Per-hour per replica | vCPU + memory tier |
| Storage | Per GB-month | Compressed data on disk |
| Network | Per GB egress | Query result sizes |
| Backups | Per GB stored | Backup retention |
Step 2: Find the top cost driver
Break storage down by table, then by column, to find bloated data. The starter
query — full breakdowns in references/implementation.md:
SELECT database, table,
formatReadableSize(sum(bytes_on_disk)) AS compressed_size,
round(sum(data_uncompressed_bytes) / sum(bytes_on_disk), 1) AS compression_ratio
FROM system.parts WHERE active
GROUP BY database, table ORDER BY sum(bytes_on_disk) DESC;