OptiHouse:~/blog
← All posts

Too many parts in ClickHouse: causes and fixes

June 15, 2026·6 min read
#ClickHouse#parts#ingestion

ClickHouse stores every insert as a part and merges parts in the background. When inserts arrive too small and too often, parts pile up faster than merges can keep up — you get Too many parts errors, throttled inserts, and queries that slow down as part counts grow.

Diagram showing 1,240 tiny ClickHouse parts collapsing into about 40 larger parts after batched inserts
Many small inserts create thousands of parts; batching collapses them.

Find the fragmented tables

A healthy MergeTree table holds tens of active parts per partition, not thousands. Rank tables by active part count and watch the average part size — many tiny parts is the tell-tale sign.

sql
SELECT database, table,
       count() AS parts,
       formatReadableSize(avg(bytes_on_disk)) AS avg_part
FROM system.parts
WHERE active
GROUP BY database, table
HAVING parts > 300
ORDER BY parts DESC;

Diagnose insert pressure

Tiny parts come from tiny, frequent inserts. system.part_log records each part as it is created — a high rate of small new parts means the writer is inserting row-by-row instead of in batches.

The fix is batching
Insert in batches of tens of thousands of rows, or enable async_insert = 1 so ClickHouse buffers small inserts server-side. Both produce fewer, larger parts and collapse merge debt at the source.

When to force a merge

OPTIMIZE TABLE ... FINAL merges parts on demand, but it is heavy — run it off-peak and only as a one-time cleanup, not on a schedule. Fixing the insert pattern is the real solution.

Full playbook
Diagnostic SQL for merge backlog and replica health is in Parts, merges & ingestion.

Catch it automatically

OptiHouse flags fragmented tables, insert pressure and merge debt on every read-only scan, each with a runbook. Start free or try the optimizer.

Read also

Common ClickHouse problems — and how to diagnose and fix each one
A troubleshooting hub for the most common ClickHouse errors and performance problems — Too Many Parts, Memory Limit Exceeded, slow queries, duplicate rows, and runaway storage — with the system-table queries to diagnose each.
Anatomy of a ClickHouse bill: finding $14,800/month of waste in one read-only scan
A transparent teardown of a representative 2.4 PB ClickHouse cluster — FINAL on every read, missing PREWHERE, weak codecs, zombie materialized views — and the exact SQL to reclaim ~$14,800/month, read-only.
ClickHouse best practices: 12 rules for fast, cheap, stable analytics
A practical, opinionated guide to ClickHouse best practices — data types, ORDER BY, batching and async inserts, materialized views, projections, skip indexes, and the schema decisions that decide whether your cluster scales.