Skip to content

AI· Case study 02

AI-assisted ClickHouse optimization with MCP

An MCP-based AI toolkit that lets Claude Code audit and optimize ClickHouse clusters across the fleet, finding the columns, tables, and queries that drive storage and compute cost and tracing each one back to the data model that created it.

Multi-TB

single columns found in one audit pass

Architecture at a glance

  1. System tables
  2. MCP server
  3. Claude Code + skills
  4. Remediation plan

01 The problem

With petabytes spread across many clusters, finding waste by hand (oversized columns, unused tables, poorly compressed data, unindexed query patterns) took days per cluster and rarely happened.

02 What I built

  1. 1MCP servers that expose cluster metrics, query logs, and system tables to AI agents in a read-only, safe way.
  2. 2Agent skills encoding ClickHouse best practices (schema, codecs, sort keys, projections, LowCardinality) so the agent cites specific rules in its recommendations.
  3. 3A fleet-wide storage audit that ranks the top columns per cluster by compressed bytes, measures cardinality with HLL sketches (~1% error) so billion-row partitions don’t hit memory limits, and maps every hot column to the SQL model that produces it.
  4. 4A coverage audit that lists tables and columns no dashboard or metrics view uses, turning dead data into concrete drop and TTL candidates.
  5. 5Written audit reports with per-cluster remediation plans: type changes, codecs, TTLs, projections, and drops.

03 Impact

A multi-day manual review became a repeatable, agent-driven audit. One pass surfaced single columns holding multiple terabytes, the starting point for cost-cutting work.

08 · Contact

Let’s build something that holds up in production.

If something here resonates, whether it’s a data problem, an idea, or a conversation worth having, I’d love to hear from you. The fastest way to reach me is a message on LinkedIn.

Good reasons to reach out

  • Data platform help

    ClickHouse or Druid performance, Kubernetes operations, migrations, and cost reviews.

  • Collaboration

    Open-source work, writing, talks, or comparing notes on a hard data problem.

  • Just to talk shop

    Real-time analytics, AdTech data, MCP and agent tooling, or life as an FDE.

esc
↑ ↓ navigate↵ select