Episode 1 started with the ending: after almost two years on ClickHouse Cloud, we moved our logs product off ClickHouse. The episodes since then covered the incidents along the way: too many parts, TTL, merge memory, shared CPU, materialized views, Altinity, JSON, data skipping indexes, and the text index.
People keep asking two questions. If we fixed all of those, why did we still move? And would we pick ClickHouse again? This last episode answers both. What we replaced it with is a separate story.
Slow queries and timeouts
Most earlier episodes were about failures we could fix or work around. Once we understood each one, a setting or schema change fixed it, or we found a reasonable tradeoff we could accept.
One class of problems never went away. Slow queries, query timeouts, and high CPU on the query cluster remained the majority of our incidents.
Logs are hard for any fixed-compute database. Teams keep every log line for months or years, and most of it is rarely read. Our read-only ClickHouse services (see Episode 4) sat nearly idle most of the day. Then when an incident starts, engineers and AI agents send many queries at once, over wide time ranges, with common words, partial words, or filters on columns outside the sort key.
Every guardrail we added had a cost:
- Lower
max_threadsstopped one query from taking every core, but more queries started to time out. - The text index made rare-word queries much faster, but it took twice the storage of the column it indexes, and some common-word queries were still slow.
- Materialized views made dashboard histograms fast, but could not cover high-cardinality filters or most ad-hoc queries from AI agents.
- A separate read-only service kept queries away from inserts and merges, but doubled our fixed compute, and queries still competed with each other.
Each fix made some slow queries faster. None of them changed the real problem: during an incident, a burst of heavy queries lands on a fixed number of CPUs.
Onboarding a large customer
Onboarding a customer was supposed to be simple: create a table from our template and start ingesting. That worked for most customers. Each large customer broke it in a different way:
- Some of their queries filtered on columns outside our sort key, so the primary index skipped almost nothing, and bloom filter indexes made those queries slower.
- Their JSON was different. One customer's wide JSON column meant hundreds of small mark files to load per part on cold reads. Another customer ran free-text searches across a JSON column, which were slow until we stored a plain-text copy of that column.
- Their ingest bursts or partition sizes caused TOO_MANY_PARTS and out-of-memory merges.
Each large onboarding took weeks of schema tuning, index benchmarks, and cluster resizing. Even then, we could not promise that their queries would not time out.
The structural mismatch: always-on compute for bursty search
ClickHouse Cloud separates storage from compute. The data is stored once, in object storage, and every compute service reads that same copy. We ran one service for inserts and merges, and one or more read-only services for queries. Scans were fast, and queries no longer slowed down inserts.
The problem was that every service is provisioned. You pick a size in advance and pay for it every hour, busy or idle.
When we onboarded one large customer early this year, we had to create a separate read-only service just for them. It was the largest size our ClickHouse Cloud Scale plan allowed, with two replicas. The chart shows its CPU over five days. During the spikes, CPU hit the limit and queries still timed out. Between the spikes, it was almost idle.

Going bigger meant paying for more cores that sat idle between spikes, at roughly $110 per vCPU per month. Sizing for normal traffic meant queries would time out during the next incident. AI agents make the peaks sharper: they send many queries at once.
That also blocked our goal on price. We want our logs product to cost customers less than the tool they use today, and to be faster. With compute sized for incident peaks, we could not get there.
For logs, we wanted storage that grows with retention and compute that runs only while a query runs. ClickHouse Cloud gave us the first but not the second, and no setting was going to change that. So we had to move off.
When I would pick ClickHouse again
Ten episodes about incidents can make any database look bad. ClickHouse is not a bad database. It is one of the fastest analytical engines I have worked with, and I would pick it again in these situations:
- Structured analytics and dashboards with predictable queries. Product events, billing rollups, and dashboards where you know the filter and
GROUP BYcolumns up front, so one sort key and a few materialized views serve almost every query. With warm caches and a matching sort key, ClickHouse answers queries over huge tables in tens of milliseconds. - One tenant or one schema. When one team owns the schema and log format, you tune the sort key, partitions, TTL, and indexes once, instead of again for every new customer.
- Steady query traffic. If queries run all day, always-on compute stays busy and the cost per query is good. Log search is the opposite: mostly idle, with sharp spikes during incidents.
- Getting to production fast at moderate scale. Building your own storage and query engine is a big investment. If your schemas are consistent, your log volume is moderate, or your team is small, ClickHouse will take you much further, much faster than building something yourself.
What I leave in AGENTS.md
The checklist from the first nine episodes:
- Parts (#1): batch big, keep partitions daily rather than hourly, and read the exact message after Code: 252 before adding CPU.
- TTL (#2): set
ttl_only_drop_parts = 1, align retention with partitions, and setmaterialize_ttl_recalculate_only = 1before changing a TTL. - Merge memory (#3): watch partition sizes and system.merges. A merge that hits the memory limit retries in a loop and burns CPU quietly.
- Shared CPU (#4): separate queries from inserts and merges on day one, cap
max_threadsand timeouts, and cancel queries when the client disconnects. - Materialized views (#5): keep rollups shallow and low-cardinality, and expect AI agents to query columns outside your MVs.
- Cloud vs BYOC (#6): weigh migration cost, disk operations, and ClickHouse Cloud release lag before you commit to a vendor.
- JSON (#7): watch mark-file counts in Wide parts on object storage. Defaults tuned for local disks can amplify cold reads.
- Data skipping indexes (#8): check every index with
EXPLAIN indexes = 1on cold-cache queries, and use hasToken rather thanLIKEalone for whole words. - Text index (#9): use it instead of
tokenbf_v1for log messages, measure the real storage overhead, and test common-word queries with a cold cache.
Wrapping up
Thank you for reading all ten episodes. Writing every failure down made us honest about which problems were our own mistakes and which were a mismatch with our workload. If you run ClickHouse in production, I would like to hear which lessons matched yours.



