<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ClickHouse Operations Guides on Netdata</title><link>https://www.netdata.cloud/guides/clickhouse/</link><description>Recent content in ClickHouse Operations Guides on Netdata</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://www.netdata.cloud/guides/clickhouse/index.xml" rel="self" type="application/rss+xml"/><item><title>ClickHouse active part count growing: reading MaxPartCountForPartition before it pages</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-active-part-count-growing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-active-part-count-growing/</guid><description>&lt;h1 id="clickhouse-active-part-count-growing-reading-maxpartcountforpartition-before-it-pages">ClickHouse active part count growing: reading MaxPartCountForPartition before it pages&lt;/h1>
&lt;p>Rising &lt;code>MaxPartCountForPartition&lt;/code> is the leading indicator for the most common ClickHouse production failure: parts accumulating faster than background merges can consolidate them. A single partition crossing 500 active parts means you have hours, not days, before inserts delay and eventually fail with &lt;code>TOO_MANY_PARTS&lt;/code>.&lt;/p>
&lt;p>The thresholds are per-partition. A table with ten partitions at fifty parts each is healthy; one partition at 950 parts is approaching throttling. Projections create hidden parts inside the same table that count toward the same limits. Materialized views route inserts to separate target tables that can hit their own limits independently.&lt;/p></description></item><item><title>ClickHouse ALTER UPDATE/DELETE overuse: why mutations are not row updates</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-alter-update-delete-overuse/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-alter-update-delete-overuse/</guid><description>&lt;h1 id="clickhouse-alter-updatedelete-overuse-why-mutations-are-not-row-updates">ClickHouse ALTER UPDATE/DELETE overuse: why mutations are not row updates&lt;/h1>
&lt;p>Your inserts are slowing down. &lt;code>system.merges&lt;/code> shows long-running background tasks with &lt;code>is_mutation = 1&lt;/code>, while the active part count climbs toward the &lt;code>parts_to_delay_insert&lt;/code> threshold. Write latency rises and &lt;code>DelayedInserts&lt;/code> increases even though memory, disk, and CPU are not exhausted. The culprit is usually an application treating ClickHouse as an OLTP store, issuing &lt;code>ALTER TABLE UPDATE&lt;/code> or &lt;code>ALTER TABLE DELETE&lt;/code> as routine operations.&lt;/p></description></item><item><title>ClickHouse async inserts: when async_insert fixes too-many-parts and when it hides it</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-async-inserts-tuning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-async-inserts-tuning/</guid><description>&lt;h1 id="clickhouse-async-inserts-when-async_insert-fixes-too-many-parts-and-when-it-hides-it">ClickHouse async inserts: when async_insert fixes too-many-parts and when it hides it&lt;/h1>
&lt;p>Async inserts move batching responsibility from the client to the ClickHouse server. The server buffers rows and flushes them as larger blocks instead of persisting every INSERT as a separate part. When the root cause is an unbatchable client, this stops the small-inserts anti-pattern from flooding the merge pool. When the root cause is high-cardinality partitioning or sustained over-ingestion, async inserts relocate the crisis into an in-memory buffer that loses data on crash and hides backpressure from the application.&lt;/p></description></item><item><title>ClickHouse authentication failures: system.session_log, brute force, and credential drift</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-authentication-failures/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-authentication-failures/</guid><description>&lt;h1 id="clickhouse-authentication-failures-systemsession_log-brute-force-and-credential-drift">ClickHouse authentication failures: system.session_log, brute force, and credential drift&lt;/h1>
&lt;p>You notice a spike in failed connection attempts to ClickHouse: a security scanner flags repeated TCP 9000 probes, or an application logs connection timeouts after a secrets rotation. ClickHouse exposes authentication events through &lt;code>system.session_log&lt;/code>, but only if the feature is enabled. Without it, fallback to server error logs and &lt;code>system.query_log&lt;/code> exceptions.&lt;/p>
&lt;p>The failures split into two patterns. Malicious: brute-force or credential-scanning campaigns against exposed TCP 9000 or HTTP 8123. Operational drift: a rotated password not updated in a client config, or a deployment shipping an old connection string. Distinguish them fast. Block an external attacker at the network layer; fix credential drift on the client.&lt;/p></description></item><item><title>ClickHouse background pool saturation: when merges and mutations starve</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-background-pool-saturation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-background-pool-saturation/</guid><description>&lt;h1 id="clickhouse-background-pool-saturation-when-merges-and-mutations-starve">ClickHouse background pool saturation: when merges and mutations starve&lt;/h1>
&lt;p>Insert latency is climbing and &lt;code>DelayedInserts&lt;/code> is ticking up. &lt;code>system.merges&lt;/code> shows every slot occupied, yet &lt;code>system.parts&lt;/code> keeps growing. When the background merge and mutation pool saturates, new merges queue instead of starting, parts accumulate, and the distance to insert rejections shrinks fast. Distinguish true thread starvation from I/O-bound stalls, identify when mutations are the culprit, and relieve pressure before inserts fail.&lt;/p></description></item><item><title>ClickHouse cannot connect to ZooKeeper/Keeper: diagnosing the coordination layer</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-connection-lost/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-connection-lost/</guid><description>&lt;h1 id="clickhouse-cannot-connect-to-zookeeperkeeper-diagnosing-the-coordination-layer">ClickHouse cannot connect to ZooKeeper/Keeper: diagnosing the coordination layer&lt;/h1>
&lt;p>If &lt;code>SELECT * FROM system.zookeeper WHERE path = '/'&lt;/code> fails, replicated tables flip to readonly, or &lt;code>ON CLUSTER&lt;/code> DDL hangs, the coordination layer is broken. The server stays up and &lt;code>GET /ping&lt;/code> returns &lt;code>Ok.&lt;/code>, so liveness checks miss the problem. Partial degradation can escalate to a write outage if replicated tables cannot re-establish sessions.&lt;/p>
&lt;p>ClickHouse uses the coordination service for ReplicatedMergeTree leader election, replication log queues, insert deduplication, and distributed DDL. ClickHouse Keeper typically listens on port 9181; external ZooKeeper ensembles listen on 2181. The diagnostic path differs slightly, but the symptom is the same: ClickHouse cannot reliably complete coordination operations.&lt;/p></description></item><item><title>ClickHouse checksum mismatch and broken parts: detecting data corruption</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-data-corruption-checksum-mismatch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-data-corruption-checksum-mismatch/</guid><description>&lt;h1 id="clickhouse-checksum-mismatch-and-broken-parts-detecting-data-corruption">ClickHouse checksum mismatch and broken parts: detecting data corruption&lt;/h1>
&lt;p>ClickHouse logs showing &lt;code>Checksum doesn't match&lt;/code>, &lt;code>Broken part&lt;/code>, or similar errors indicate data corruption. Affected parts move to &lt;code>system.detached_parts&lt;/code>. Queries may throw exceptions or return partial results. On replicated clusters, a replica with corrupt parts may lag because it cannot validate fetched parts. Corruption does not self-resolve. You must quarantine the bad part, identify the root cause, and rebuild the data from a healthy source or backup.&lt;/p></description></item><item><title>ClickHouse client connections climbing: TCP 9000, HTTP 8123, and connection leaks</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-connection-count-climbing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-connection-count-climbing/</guid><description>&lt;h1 id="clickhouse-client-connections-climbing-tcp-9000-http-8123-and-connection-leaks">ClickHouse client connections climbing: TCP 9000, HTTP 8123, and connection leaks&lt;/h1>
&lt;p>&lt;code>TCPConnection&lt;/code> or &lt;code>HTTPConnection&lt;/code> climbing on a ClickHouse node means each active socket consumes a file descriptor. When growth is uncorrelated with query throughput, it is usually a connection leak or pool misconfiguration rather than healthy concurrency. If the count approaches &lt;code>max_connections&lt;/code>, the server rejects new client connections. If the Linux &lt;code>nofile&lt;/code> limit is reached first, queries and merges fail with &amp;ldquo;too many open files.&amp;rdquo;&lt;/p></description></item><item><title>ClickHouse DB::Exception: Too many parts - causes and fixes</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-parts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-parts/</guid><description>&lt;h1 id="clickhouse-dbexception-too-many-parts---causes-and-fixes">ClickHouse DB::Exception: Too many parts - causes and fixes&lt;/h1>
&lt;p>When logs show &lt;code>DB::Exception: Too many parts (N). Merges are processing significantly slower than inserts&lt;/code> (exception code 252), INSERTs that succeeded yesterday are now failing. Data backs up in ingestors, message queues, or client buffers, and every retry adds load to a system already drowning in small files.&lt;/p>
&lt;p>At least one partition in a MergeTree table has exceeded the hard limit for active data parts, and background merges cannot consolidate them fast enough. Do not restart the server or raise the limit indefinitely. Reduce the part creation rate, remove blockers from the merge pipeline, and give background threads runway to catch up.&lt;/p></description></item><item><title>ClickHouse DelayedInserts climbing: the warning before too-many-parts</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-delayed-inserts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-delayed-inserts/</guid><description>&lt;h1 id="clickhouse-delayedinserts-climbing-the-warning-before-too-many-parts">ClickHouse DelayedInserts climbing: the warning before too-many-parts&lt;/h1>
&lt;p>Insert latency is climbing and &lt;code>system.events.DelayedInserts&lt;/code> is no longer flat. ClickHouse is sleeping during INSERT because at least one partition has crossed &lt;code>parts_to_delay_insert&lt;/code>. The database still accepts writes, but injects a sleep before each insert commits. This is the warning window before hard failure. If the merge backlog is not resolved, &lt;code>DelayedInserts&lt;/code> climbs until &lt;code>RejectedInserts&lt;/code> starts ticking and clients receive &lt;code>DB::Exception: Too many parts&lt;/code>.&lt;/p></description></item><item><title>ClickHouse detached parts piling up: reading system.detached_parts and reclaiming space</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-detached-parts-piling-up/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-detached-parts-piling-up/</guid><description>&lt;h1 id="clickhouse-detached-parts-piling-up-reading-systemdetached_parts-and-reclaiming-space">ClickHouse detached parts piling up: reading system.detached_parts and reclaiming space&lt;/h1>
&lt;p>Disk usage is climbing and &lt;code>system.disks&lt;/code> shows &lt;code>unreserved_space&lt;/code> shrinking, yet active part counts in &lt;code>system.parts&lt;/code> look normal. Queries are not failing, merges appear healthy, and there is no insert rejection storm. The hidden consumer is often a growing pile of &lt;strong>detached parts&lt;/strong>: directories that ClickHouse removed from the active dataset but left on the filesystem. Unlike active parts, detached parts do not participate in queries or merges, and ClickHouse never deletes them automatically. Standard monitoring that only watches &lt;code>system.parts&lt;/code> with &lt;code>active = 1&lt;/code> misses them entirely. This article explains how to read &lt;code>system.detached_parts&lt;/code>, interpret the &lt;code>reason&lt;/code> column, decide whether to reattach or discard the data, and prevent silent recurrence.&lt;/p></description></item><item><title>ClickHouse disk space collapse: why merges need free space and how the spiral starts</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-disk-space-collapse/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-disk-space-collapse/</guid><description>&lt;h1 id="clickhouse-disk-space-collapse-why-merges-need-free-space-and-how-the-spiral-starts">ClickHouse disk space collapse: why merges need free space and how the spiral starts&lt;/h1>
&lt;p>Disk usage climbs from 75% to 85% over a week, then hits 90%. A few hours later ClickHouse rejects inserts, part counts spike, and the volume is at 98%. The system did not simply run out of space. It entered a self-reinforcing spiral where background merges, the mechanism that reclaims space, stalled because they needed free space to work.&lt;/p></description></item><item><title>ClickHouse disk space monitoring: free_space, unreserved_space, and the 80% target</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-disk-space-monitoring/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-disk-space-monitoring/</guid><description>&lt;h1 id="clickhouse-disk-space-monitoring-free_space-unreserved_space-and-the-80-target">ClickHouse disk space monitoring: free_space, unreserved_space, and the 80% target&lt;/h1>
&lt;p>ClickHouse disk space is not a simple capacity gauge. Merges write new parts before deleting old ones, so free space is an operational dependency of the storage engine. Insufficient disk does not just mean &amp;ldquo;running low&amp;rdquo;: background merges stall, parts accumulate, and the system enters a self-reinforcing death spiral.&lt;/p>
&lt;p>This guide covers the &lt;code>system.disks&lt;/code> metrics, why &lt;code>unreserved_space&lt;/code> matters more than &lt;code>free_space&lt;/code>, and operational targets that keep merges alive.&lt;/p></description></item><item><title>ClickHouse distributed DDL stuck: ON CLUSTER queries that never finish</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-distributed-ddl-stuck/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-distributed-ddl-stuck/</guid><description>&lt;h1 id="clickhouse-distributed-ddl-stuck-on-cluster-queries-that-never-finish">ClickHouse distributed DDL stuck: ON CLUSTER queries that never finish&lt;/h1>
&lt;p>&lt;code>ON CLUSTER&lt;/code> DDL is not atomic. The initiator writes a task into a shared queue in ZooKeeper or ClickHouse Keeper under &lt;code>/clickhouse/task_queue/ddl/&lt;/code>. Each node pulls entries in order, executes the DDL locally, and reports status back. One slow, down, or misconfigured node can leave the entry unfinished forever, blocking all later DDL on that node and creating schema drift that is invisible until a replica rejects an insert or a subsequent ALTER fails.&lt;/p></description></item><item><title>ClickHouse distributed query amplification: one coordinator, many shard subqueries</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-distributed-query-amplification/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-distributed-query-amplification/</guid><description>&lt;h1 id="clickhouse-distributed-query-amplification-one-coordinator-many-shard-subqueries">ClickHouse distributed query amplification: one coordinator, many shard subqueries&lt;/h1>
&lt;p>A SELECT against a distributed table registers one entry in &lt;code>system.processes&lt;/code> on the coordinator. That query fans out subqueries to every addressed shard, waits for intermediate results, then merges them locally. True CPU, memory, and network load is multiplied by the shard count, and the slowest participating shard dictates latency.&lt;/p>
&lt;p>This amplification is invisible to cluster-average metrics. A dashboard averaging CPU or query latency across all nodes can look healthy while one shard is saturated, because the coordinator and healthy shards mask the straggler. Operators often misdiagnose the slowdown as a generalized cluster problem or a coordinator bottleneck, when the root cause is usually a single overloaded shard, a missing sharding key filter, or an expensive GLOBAL operator that broadcasts data across the network.&lt;/p></description></item><item><title>ClickHouse full table scan: partition pruning failures and the primary key</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-full-table-scan-no-partition-pruning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-full-table-scan-no-partition-pruning/</guid><description>&lt;h1 id="clickhouse-full-table-scan-partition-pruning-failures-and-the-primary-key">ClickHouse full table scan: partition pruning failures and the primary key&lt;/h1>
&lt;p>A query that returned in milliseconds yesterday now takes minutes and saturates CPU. Check whether it is reading every row before you add vCPUs or shards. A missing filter on the partition key or a mismatch with the primary key prefix forces ClickHouse to open every part and scan every granule. Symptoms are runaway &lt;code>read_rows&lt;/code> counts, tail latency spikes, and sustained CPU decompression that hardware scaling cannot fix.&lt;/p></description></item><item><title>ClickHouse insert latency rising: the leading indicator of write-pipeline trouble</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-insert-latency-rising/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-insert-latency-rising/</guid><description>&lt;h1 id="clickhouse-insert-latency-rising-the-leading-indicator-of-write-pipeline-trouble">ClickHouse insert latency rising: the leading indicator of write-pipeline trouble&lt;/h1>
&lt;p>Your ClickHouse inserts are taking longer. A query that committed in 200 ms last week is now taking 5 seconds, then 15, then 30. In most databases this signals slow disks or lock contention. In ClickHouse, sustained insert latency is the earliest operational signal that the write pipeline is congesting. It precedes &lt;code>DelayedInserts&lt;/code>, part-count alerts, and the hard stop of &lt;code>RejectedInserts&lt;/code> by minutes to hours. Wait for the error and the merge debt is already severe.&lt;/p></description></item><item><title>ClickHouse Keeper latency high: the early warning before sessions expire</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-latency-high/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-latency-high/</guid><description>&lt;h1 id="clickhouse-keeper-latency-high-the-early-warning-before-sessions-expire">ClickHouse Keeper latency high: the early warning before sessions expire&lt;/h1>
&lt;p>INSERTs to replicated tables slow down, &lt;code>ON CLUSTER&lt;/code> DDL hangs, and the replication queue grows on followers. &lt;code>SELECT 1&lt;/code> and HTTP &lt;code>/ping&lt;/code> stay healthy, and non-replicated tables are fine. The culprit is usually the coordination service, not ClickHouse itself.&lt;/p>
&lt;p>Rising ZooKeeper or ClickHouse Keeper operation latency is a leading indicator. Replicated inserts, replication log updates, and distributed DDL all round-trip through Keeper. Because Keeper writes its transaction log synchronously, disk I/O on the Keeper node is the most common bottleneck. A degraded-but-connected coordination service is worse than a hard partition: it silently slows every replicated operation until sessions start expiring and replicas flip to readonly. This article explains how to read the early signals, isolate the cause, and fix it before sessions expire.&lt;/p></description></item><item><title>ClickHouse Keeper saturation spiral: too many tables, DDL storms, and cluster freeze</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-saturation-spiral/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-keeper-saturation-spiral/</guid><description>&lt;h1 id="clickhouse-keeper-saturation-spiral-too-many-tables-ddl-storms-and-cluster-freeze">ClickHouse Keeper saturation spiral: too many tables, DDL storms, and cluster freeze&lt;/h1>
&lt;p>INSERTs fail. Replicated tables flip read-only. &lt;code>ON CLUSTER&lt;/code> DDL hangs. &lt;code>curl http://localhost:8123/ping&lt;/code> still returns &lt;code>Ok.&lt;/code> and &lt;code>SELECT 1&lt;/code> still works. This is Keeper saturation: the coordination layer is choking while liveness probes give false confidence.&lt;/p>
&lt;p>The spiral starts when ZooKeeper or ClickHouse Keeper cannot keep up with metadata load. Every replicated table registers znodes and watches. Every DDL operation adds more. Coordination latency climbs until heartbeat traffic cannot complete within the negotiated session timeout; sessions expire, replicas become read-only, and writes fail. Reconnecting nodes then trigger a thundering herd.&lt;/p></description></item><item><title>ClickHouse killed by the OOM killer: RSS, max_server_memory_usage, and cgroup limits</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-oom-killed-by-kernel/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-oom-killed-by-kernel/</guid><description>&lt;h1 id="clickhouse-killed-by-the-oom-killer-rss-max_server_memory_usage-and-cgroup-limits">ClickHouse killed by the OOM killer: RSS, max_server_memory_usage, and cgroup limits&lt;/h1>
&lt;p>You restart a pod and &lt;code>kubectl describe pod&lt;/code> shows &lt;code>Reason: OOMKilled&lt;/code> with exit code 137. Inside ClickHouse, &lt;code>MemoryTracking&lt;/code> sits well below &lt;code>max_server_memory_usage&lt;/code>, and &lt;code>system.text_log&lt;/code> shows no warning. The process is gone, merges are dead, and replication queues are backing up.&lt;/p>
&lt;p>The Linux OOM killer targets RSS, not ClickHouse&amp;rsquo;s internal &lt;code>MemoryTracking&lt;/code>. Untracked allocations, jemalloc arena fragmentation, and cgroup accounting quirks create a persistent gap between what ClickHouse thinks it is using and what the kernel sees. In containerized environments, the cgroup OOM killer can evict the pod before ClickHouse ever triggers its own server-wide limit.&lt;/p></description></item><item><title>ClickHouse long-running queries: finding and killing the resource hog</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-long-running-queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-long-running-queries/</guid><description>&lt;h1 id="clickhouse-long-running-queries-finding-and-killing-the-resource-hog">ClickHouse long-running queries: finding and killing the resource hog&lt;/h1>
&lt;p>A query that should finish in seconds is still running after twenty minutes. Memory on the ClickHouse node is climbing, query latency has doubled, and you suspect a single query is holding resources it will never release. In ClickHouse, a long-running query can be a legitimate analytical job crunching terabytes, a Cartesian JOIN exploding in memory, or a GROUP BY that has spilled to disk and slowed to a crawl. Telling the difference determines whether you kill it or let it finish.&lt;/p></description></item><item><title>ClickHouse mark cache and uncompressed cache: reading low hit rates</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-cache-hit-rate-low/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-cache-hit-rate-low/</guid><description>&lt;h1 id="clickhouse-mark-cache-and-uncompressed-cache-reading-low-hit-rates">ClickHouse mark cache and uncompressed cache: reading low hit rates&lt;/h1>
&lt;p>ClickHouse query latency spikes after a restart, or monitoring shows a sustained drop in mark cache hit rate. Before increasing &lt;code>mark_cache_size&lt;/code>, determine whether you are seeing normal warmup or a cache that is too small for the working set.&lt;/p>
&lt;p>The mark cache stores primary key index granule positions. The uncompressed cache stores decompressed column blocks. Low hit rates in each produce different symptoms. This guide covers how to read the metrics, distinguish warmup from real problems, and decide when tuning is warranted.&lt;/p></description></item><item><title>ClickHouse Memory limit (for query) exceeded: per-query limits and GROUP BY/JOIN blowups</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-limit-for-query-exceeded/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-limit-for-query-exceeded/</guid><description>&lt;h1 id="clickhouse-memory-limit-for-query-exceeded-per-query-limits-and-group-byjoin-blowups">ClickHouse Memory limit (for query) exceeded: per-query limits and GROUP BY/JOIN blowups&lt;/h1>
&lt;p>&lt;code>Code: 241. DB::Exception: Memory limit (for query) exceeded&lt;/code> means a single query&amp;rsquo;s allocations breached the &lt;code>max_memory_usage&lt;/code> ceiling. ClickHouse tracks memory in a hierarchy: server-wide, per-user, and per-query. The server kills the query to protect the rest of the workload.&lt;/p>
&lt;p>This differs from &lt;code>Memory limit (total) exceeded&lt;/code> (server-level pressure) and &lt;code>Memory limit (for user) exceeded&lt;/code> (profile-level pressure). A query-level breach usually stems from one of three patterns: a high-cardinality &lt;code>GROUP BY&lt;/code>, an unbounded &lt;code>DISTINCT&lt;/code>, or a &lt;code>JOIN&lt;/code> that materializes more rows than expected.&lt;/p></description></item><item><title>ClickHouse Memory limit (total) exceeded - server-wide memory pressure and fixes</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-limit-total-exceeded/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-limit-total-exceeded/</guid><description>&lt;h1 id="clickhouse-memory-limit-total-exceeded---server-wide-memory-pressure-and-fixes">ClickHouse Memory limit (total) exceeded - server-wide memory pressure and fixes&lt;/h1>
&lt;p>&lt;code>Code: 241. DB::Exception: Memory limit (total) exceeded: would use X bytes, current RSS Y, maximum Z.&lt;/code> is the server-level cap, not a per-query limit. When ClickHouse&amp;rsquo;s &lt;code>MemoryTracking&lt;/code> hits &lt;code>max_server_memory_usage&lt;/code> (default 90% of physical RAM), the server kills the heaviest running queries to protect the process. New and existing queries fail until memory drops. Find the largest memory consumer and stop it before the OOM killer does.&lt;/p></description></item><item><title>ClickHouse memory pressure death spiral: runaway queries, retries, and OOM</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-pressure-death-spiral/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-pressure-death-spiral/</guid><description>&lt;h1 id="clickhouse-memory-pressure-death-spiral-runaway-queries-retries-and-oom">ClickHouse memory pressure death spiral: runaway queries, retries, and OOM&lt;/h1>
&lt;p>&lt;code>MEMORY_LIMIT_EXCEEDED&lt;/code> errors climb in the query log. Queries that normally finish in seconds now take minutes or are killed outright. The ClickHouse process is near its memory limit, but killing the heaviest query only frees capacity for a moment before another query is killed. If the application retries immediately, pressure never drops. With spill-to-disk enabled, the bottleneck shifts to disk I/O, starving background merges and slowing the whole system.&lt;/p></description></item><item><title>ClickHouse MemoryTracking vs MemoryResident: reading the memory gap correctly</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-tracking-vs-rss/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-memory-tracking-vs-rss/</guid><description>&lt;h1 id="clickhouse-memorytracking-vs-memoryresident-reading-the-memory-gap-correctly">ClickHouse MemoryTracking vs MemoryResident: reading the memory gap correctly&lt;/h1>
&lt;p>You finish a large batch query, open monitoring, and see ClickHouse MemoryTracking drop by 40 GB while MemoryResident barely moves. Or you watch RSS climb for hours after a restart while MemoryTracking tracks the rise steadily. Neither pattern indicates a leak. The gap between ClickHouse&amp;rsquo;s internal ledger and OS resident set size is normal: the server accounts for memory synchronously while jemalloc retains pages for reuse.&lt;/p></description></item><item><title>ClickHouse merge death spiral: when parts accumulate faster than merges consolidate</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-merge-death-spiral/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-merge-death-spiral/</guid><description>&lt;h1 id="clickhouse-merge-death-spiral-when-parts-accumulate-faster-than-merges-consolidate">ClickHouse merge death spiral: when parts accumulate faster than merges consolidate&lt;/h1>
&lt;p>Insert latency climbs. Application logs show ClickHouse throttling writes. Eventually inserts fail with &lt;code>Too many parts&lt;/code>. Disk usage rises even though ingestion volume is flat. The cluster is up but refusing writes.&lt;/p>
&lt;p>This is the merge death spiral: a self-reinforcing loop where parts accumulate faster than background merges consolidate them. Every INSERT creates immutable on-disk parts. Background merge threads combine smaller parts into larger ones to keep query performance healthy and part counts low. When insert pressure exceeds merge throughput, the backlog grows, merge overhead increases, and the system chokes on its own structure.&lt;/p></description></item><item><title>ClickHouse merge duration climbing: the leading indicator of part explosion</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-merge-duration-climbing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-merge-duration-climbing/</guid><description>&lt;h1 id="clickhouse-merge-duration-climbing-the-leading-indicator-of-part-explosion">ClickHouse merge duration climbing: the leading indicator of part explosion&lt;/h1>
&lt;p>&lt;code>system.merges&lt;/code> shows elapsed times in hours. Your dashboards show P99 merge duration climbing over the past 48 hours. Rising merge duration is the earliest signal that your cluster is heading toward a part-count crisis, typically 1 to 3 days before inserts throttle or fail entirely. &lt;!-- TODO: verify 1-3 day lead time generalizes across ingest patterns and cluster sizes -->&lt;/p></description></item><item><title>ClickHouse merges not keeping up: diagnosing a stalled or starved merge pool</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-merges-not-keeping-up/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-merges-not-keeping-up/</guid><description>&lt;h1 id="clickhouse-merges-not-keeping-up-diagnosing-a-stalled-or-starved-merge-pool">ClickHouse merges not keeping up: diagnosing a stalled or starved merge pool&lt;/h1>
&lt;p>When insert latency climbs and &lt;code>system.merges&lt;/code> is empty while active parts grow, the background merge pool is likely stalled or starved. ClickHouse relies on background merges to consolidate immutable parts after each INSERT. Without merges, parts accumulate: query scans open more files, memory pressure shifts to the mark cache and file descriptor tables, and the system approaches the &lt;code>TOO_MANY_PARTS&lt;/code> threshold.&lt;/p></description></item><item><title>ClickHouse monitoring checklist: the signals every production cluster needs</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-monitoring-checklist/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-monitoring-checklist/</guid><description>&lt;h1 id="clickhouse-monitoring-checklist-the-signals-every-production-cluster-needs">ClickHouse monitoring checklist: the signals every production cluster needs&lt;/h1>
&lt;p>ClickHouse failures usually begin as storage-structure debt: immutable parts accumulate faster than merges consolidate them, coordination sessions expire, or disk space drops below the threshold merges need to complete. Query latency degrades only after the crisis is hours old.&lt;/p>
&lt;p>This checklist groups monitoring signals into four maturity levels. Level 1 is the minimum viable instrumentation to avoid data loss and unavailability. Each subsequent level adds leading indicators that catch part accumulation, replication divergence, and memory pressure while they are still reversible. The signals are drawn from ClickHouse system tables and OS-level metrics. They apply to single-node, sharded, and replicated setups; replicated tables add ZooKeeper/Keeper signals that belong in Level 2.&lt;/p></description></item><item><title>ClickHouse monitoring maturity model: from survival to expert</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-monitoring-maturity-model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-monitoring-maturity-model/</guid><description>&lt;h1 id="clickhouse-monitoring-maturity-model-from-survival-to-expert">ClickHouse monitoring maturity model: from survival to expert&lt;/h1>
&lt;p>Most production ClickHouse incidents are not mysterious. They are predictable storage-structure or coordination failures that better monitoring would have surfaced hours earlier. If you are running ClickHouse at scale, you need to know whether your observability is actually catching the failure modes that matter, or just proving that the process is running.&lt;/p>
&lt;p>This maturity model is a diagnostic mirror, not a trophy case. Use it to audit your dashboards, tune alert noise, and decide what to instrument next. Each level builds on the last. Skipping levels leaves predictable gaps: teams with beautiful query-latency dashboards still get surprised by merge death spirals because they never instrumented part counts per partition.&lt;/p></description></item><item><title>ClickHouse mutation stuck: parts_to_do not decreasing and how to recover</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-mutation-stuck/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-mutation-stuck/</guid><description>&lt;h1 id="clickhouse-mutation-stuck-parts_to_do-not-decreasing-and-how-to-recover">ClickHouse mutation stuck: parts_to_do not decreasing and how to recover&lt;/h1>
&lt;p>Check &lt;code>system.mutations&lt;/code> and find a mutation active for hours. &lt;code>parts_to_do&lt;/code> has not moved in thirty minutes and parts are accumulating. Queries return, but insert latency climbs. On replicated tables, each replica processes mutations independently, so a stall on one node creates silent divergence while the rest of the cluster appears healthy.&lt;/p>
&lt;p>Mutations rewrite data parts to apply &lt;code>ALTER UPDATE&lt;/code>, &lt;code>ALTER DELETE&lt;/code>, or projection changes. They run sequentially per table and share the background merge and mutation pool with regular merges. A stalled mutation blocks subsequent mutations for that table and consumes threads needed for merges. The result is merge starvation, insert delays, and eventually &lt;code>Too many parts&lt;/code> rejections.&lt;/p></description></item><item><title>ClickHouse mutations silently blocking merges: the hidden cause of part growth</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-mutations-blocking-merges/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-mutations-blocking-merges/</guid><description>&lt;h1 id="clickhouse-mutations-silently-blocking-merges-the-hidden-cause-of-part-growth">ClickHouse mutations silently blocking merges: the hidden cause of part growth&lt;/h1>
&lt;p>You are watching part counts climb on a ClickHouse node. &lt;code>system.merges&lt;/code> shows active background tasks, health checks return Ok, and the log shows no mutation errors. Yet inserts are slowing and &lt;code>MaxPartCountForPartition&lt;/code> is trending toward the delay threshold. The pool looks busy, so merges should be keeping up. They are not: some of those busy slots are mutations, and mutations starve merges silently.&lt;/p></description></item><item><title>ClickHouse No space left on device: emergency recovery when the data disk fills</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-no-space-left-on-device/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-no-space-left-on-device/</guid><description>&lt;h1 id="clickhouse-no-space-left-on-device-emergency-recovery-when-the-data-disk-fills">ClickHouse No space left on device: emergency recovery when the data disk fills&lt;/h1>
&lt;p>When ClickHouse returns &lt;code>No space left on device&lt;/code> to client inserts or the server log fills with write errors, the situation is past a simple capacity alert. ClickHouse does not degrade gradually on a full disk. Background merges halt immediately because they require temporary free space to write combined parts before removing source files. Once merges stop, small insert parts accumulate, metadata overhead grows, and disk usage accelerates. TTL-based expiration also stops because TTL cleanup is executed by merges. ClickHouse system tables such as &lt;code>system.query_log&lt;/code> and &lt;code>system.part_log&lt;/code> are MergeTree tables that can grow unbounded and consume the remaining space.&lt;/p></description></item><item><title>ClickHouse projections and hidden parts: the part count you can't see</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-projections-hidden-parts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-projections-hidden-parts/</guid><description>&lt;h1 id="clickhouse-projections-and-hidden-parts-the-part-count-you-cant-see">ClickHouse projections and hidden parts: the part count you can&amp;rsquo;t see&lt;/h1>
&lt;p>Inserts fail with &lt;code>TOO_MANY_PARTS&lt;/code> while &lt;code>system.parts&lt;/code> on the base table looks comfortable. If you monitor only the source table, you are missing projection sub-parts inside base directories and independent parts in materialized view target tables. A single insert can spawn parts across projection subdirectories and multiple downstream tables. The number in &lt;code>system.parts&lt;/code> is a floor, not a ceiling. The gap between visible and real part count is where merge crises begin.&lt;/p></description></item><item><title>ClickHouse query error rate high: reading exception codes 241, 252, and 999</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-query-error-rate-high/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-query-error-rate-high/</guid><description>&lt;h1 id="clickhouse-query-error-rate-high-reading-exception-codes-241-252-and-999">ClickHouse query error rate high: reading exception codes 241, 252, and 999&lt;/h1>
&lt;h2 id="what-this-means">What this means&lt;/h2>
&lt;p>ClickHouse logs failed queries to system.query_log with type = &amp;lsquo;ExceptionWhileProcessing&amp;rsquo; and a numeric exception_code. The FailedQuery counter in system.events increments for each failure. Keep the FailedQuery / Query ratio below 1%. A sustained climb above that threshold signals a systemic issue, not a few bad queries.&lt;/p>
&lt;p>The codes that dominate production incidents fall into five classes. &lt;!-- TODO: verify exception code numbers and descriptions against your ClickHouse version -->&lt;/p></description></item><item><title>ClickHouse query latency P99 spikes: tail latency, hot shards, and cold data</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-query-latency-p99-spikes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-query-latency-p99-spikes/</guid><description>&lt;h1 id="clickhouse-query-latency-p99-spikes-tail-latency-hot-shards-and-cold-data">ClickHouse query latency P99 spikes: tail latency, hot shards, and cold data&lt;/h1>
&lt;p>Your ClickHouse cluster shows healthy average query latency, but users report intermittent timeouts. P99 spikes while P50 stays flat. This divergence is tail latency: a subset of queries is dramatically slower. In distributed clusters, the culprit is often a single hot shard or a replica serving stale data. In tiered storage, a query touching cold S3 data can be one to two orders of magnitude slower.&lt;/p></description></item><item><title>ClickHouse Replica is lost: SYSTEM RESTORE REPLICA and recovering a diverged replica</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-replica-is-lost/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-replica-is-lost/</guid><description>&lt;h1 id="clickhouse-replica-is-lost-system-restore-replica-and-recovering-a-diverged-replica">ClickHouse Replica is lost: SYSTEM RESTORE REPLICA and recovering a diverged replica&lt;/h1>
&lt;p>You run &lt;code>SELECT count()&lt;/code> on two replicas and get different results. Your application returns inconsistent aggregations depending on which node answers. The replication dashboard looks green: ZooKeeper sessions are active, &lt;code>queue_size&lt;/code> is zero, and no replica is &lt;code>readonly&lt;/code>. The replica has permanently lost parts, but ZooKeeper does not know because the loss happened outside the replication log. Silent divergence hides behind healthy metrics until queries start returning wrong results.&lt;/p></description></item><item><title>ClickHouse replicas out of sync: when SELECT count() differs across replicas</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-replicas-out-of-sync-counts-differ/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-replicas-out-of-sync-counts-differ/</guid><description>&lt;h1 id="clickhouse-replicas-out-of-sync-when-select-count-differs-across-replicas">ClickHouse replicas out of sync: when SELECT count() differs across replicas&lt;/h1>
&lt;p>You run the same &lt;code>SELECT count()&lt;/code> against two replicas and get different numbers. The replica with the lower count still responds instantly, its HTTP ping returns &lt;code>Ok.&lt;/code>, its replication queue may even be empty, and its CPU and memory look fine. Standard liveness checks give false confidence while the replica serves stale or incomplete data.&lt;/p>
&lt;p>ClickHouse replication is asynchronous and coordinated through ZooKeeper or ClickHouse Keeper. A replica can lose its session, miss fetches, or silently drop data, yet continue serving reads from local disk. Distributed queries hide the divergence unless you compare row counts or partition metadata across nodes.&lt;/p></description></item><item><title>ClickHouse ReplicatedDataLoss > 0: detecting and responding to lost parts</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-replicated-data-loss/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-replicated-data-loss/</guid><description>&lt;h1 id="clickhouse-replicateddataloss--0-detecting-and-responding-to-lost-parts">ClickHouse ReplicatedDataLoss &amp;gt; 0: detecting and responding to lost parts&lt;/h1>
&lt;p>&lt;code>ReplicatedDataLoss &amp;gt; 0&lt;/code> is a hard signal in ClickHouse. A nonzero value in &lt;code>system.events&lt;/code> means the server has determined that a data part is missing and cannot be retrieved from any available replica. This is not replication lag, a transient fetch failure, or the normal &lt;code>ReplicatedPartFetchesOfMerged&lt;/code> optimization.&lt;/p>
&lt;p>Queries that touch the affected part can return incomplete results or errors. The immediate risk is silent divergence between replicas, where one replica serves stale or incomplete results without failing the query. Confirm the event, identify the scope, and determine whether a healthy peer still has the part.&lt;/p></description></item><item><title>ClickHouse replication lag: absolute_delay, queue_size, and catch-up diagnosis</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-replication-lag/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-replication-lag/</guid><description>&lt;h1 id="clickhouse-replication-lag-absolute_delay-queue_size-and-catch-up-diagnosis">ClickHouse replication lag: absolute_delay, queue_size, and catch-up diagnosis&lt;/h1>
&lt;p>You notice &lt;code>absolute_delay&lt;/code> climbing on one replica. SELECTs there return older rows than on peers, and failover to the lagging node risks losing recently inserted data. In ClickHouse, replication lag is not a single failure; it is a symptom with several distinct causes. A replica can fall behind because it cannot pull entries from the Keeper log, because it cannot fetch parts fast enough, because a mutation is blocking the queue, or because the source replica itself is too slow to serve data.&lt;/p></description></item><item><title>ClickHouse replication queue stuck: num_tries, last_exception, and dead entries</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-replication-queue-stuck/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-replication-queue-stuck/</guid><description>&lt;h1 id="clickhouse-replication-queue-stuck-num_tries-last_exception-and-dead-entries">ClickHouse replication queue stuck: num_tries, last_exception, and dead entries&lt;/h1>
&lt;p>A replica can show low &lt;code>absolute_delay&lt;/code> in &lt;code>system.replicas&lt;/code> while &lt;code>system.replication_queue&lt;/code> contains entries with &lt;code>num_tries&lt;/code> in the hundreds and the same &lt;code>last_exception&lt;/code> repeating for hours. These dead entries do not self-resolve. They block merges, fetches, or mutations, causing silent divergence and stale reads. This guide shows how to read the queue correctly, identify the failure mode from the entry type, and clear the blockage without making the replica diverge further.&lt;/p></description></item><item><title>ClickHouse slow queries: diagnosis from query_log to plan to fix</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-slow-queries-diagnosis/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-slow-queries-diagnosis/</guid><description>&lt;h1 id="clickhouse-slow-queries-diagnosis-from-query_log-to-plan-to-fix">ClickHouse slow queries: diagnosis from query_log to plan to fix&lt;/h1>
&lt;p>P99 latency climbs before averages move. In ClickHouse, tail latency spikes usually mean a subset of queries is hitting cold data, scanning too many parts, or spilling to disk. The goal is to separate plan problems from resource problems fast, then confirm the fix before the next batch of queries arrives.&lt;/p>
&lt;h2 id="what-this-means">What this means&lt;/h2>
&lt;p>Slow queries show up as rising &lt;code>query_duration_ms&lt;/code> in &lt;code>system.query_log&lt;/code> for &lt;code>QueryFinish&lt;/code> events, or rising &lt;code>elapsed&lt;/code> in &lt;code>system.processes&lt;/code>. ClickHouse latency is sensitive to how many parts a query opens, whether the mark cache is warm, and whether the pipeline stays in memory.&lt;/p></description></item><item><title>ClickHouse small inserts anti-pattern: why single-row inserts melt the merge pool</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-small-inserts-anti-pattern/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-small-inserts-anti-pattern/</guid><description>&lt;h1 id="clickhouse-small-inserts-anti-pattern-why-single-row-inserts-melt-the-merge-pool">ClickHouse small inserts anti-pattern: why single-row inserts melt the merge pool&lt;/h1>
&lt;p>&lt;code>DB::Exception: Too many parts&lt;/code> spikes, query latency climbs, and the background merge pool runs flat out while making no progress. Disk, CPU, and memory look healthy. The cause is usually single-row INSERTs from the application.&lt;/p>
&lt;p>Every INSERT into a MergeTree table creates at least one immutable data part on disk. ClickHouse is optimized for batch inserts. When clients send single-row or micro-batch inserts, parts are created faster than background merges can consolidate them. This is the number one driver of part accumulation in production clusters.&lt;/p></description></item><item><title>ClickHouse system log tables eating disk: query_log, part_log, and TTL</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-system-tables-unbounded-growth/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-system-tables-unbounded-growth/</guid><description>&lt;h1 id="clickhouse-system-log-tables-eating-disk-query_log-part_log-and-ttl">ClickHouse system log tables eating disk: query_log, part_log, and TTL&lt;/h1>
&lt;p>You are investigating disk growth on a ClickHouse node. User tables look reasonable, but &lt;code>system.query_log&lt;/code> or &lt;code>system.part_log&lt;/code> are consuming tens or hundreds of gigabytes. These tables use MergeTree-family engines and are subject to the same part-count and merge pressure limits as production tables. Without a TTL rule, data accumulates forever. During incidents with high query error rates or retry storms, &lt;code>query_log&lt;/code> can expand fast enough to threaten disk capacity and stall logging.&lt;/p></description></item><item><title>ClickHouse Table is in readonly mode: is_readonly on replicated tables and how to fix it</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-table-is-in-readonly-mode/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-table-is-in-readonly-mode/</guid><description>&lt;h1 id="clickhouse-table-is-in-readonly-mode-is_readonly-on-replicated-tables-and-how-to-fix-it">ClickHouse Table is in readonly mode: is_readonly on replicated tables and how to fix it&lt;/h1>
&lt;p>Inserts fail with &lt;code>TABLE_IS_READ_ONLY&lt;/code>. &lt;code>system.replicas&lt;/code> shows &lt;code>is_readonly = 1&lt;/code> for affected tables and the replica rejects writes. For replicated tables, this is a coordination failure, not a disk or memory problem: the replica has lost its session with ClickHouse Keeper or ZooKeeper, or the ensemble is unreachable.&lt;/p>
&lt;p>Reads from local parts may still succeed, which hides the failure from load balancers and monitoring probes that rely on &lt;code>SELECT 1&lt;/code> or the HTTP ping endpoint. Brief readonly states lasting seconds are normal during Keeper leader elections. Sustained readonly lasting minutes means the replica is diverging and inserts are being lost or routed elsewhere.&lt;/p></description></item><item><title>ClickHouse too many open files: file descriptors, part count, and nofile limits</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-open-file-descriptors-exhausted/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-open-file-descriptors-exhausted/</guid><description>&lt;h1 id="clickhouse-too-many-open-files-file-descriptors-part-count-and-nofile-limits">ClickHouse too many open files: file descriptors, part count, and nofile limits&lt;/h1>
&lt;p>ClickHouse aborts queries with &amp;ldquo;Too many open files&amp;rdquo; or the server process dies. Logs show errors about failing to open column files or metadata. This is not a traditional leak; it is a capacity cliff. Every active MergeTree part keeps multiple files open, background merges temporarily spike that count, and the Linux nofile limit is usually the bottleneck. The default limit of 1024 is catastrophic for production ClickHouse.&lt;/p></description></item><item><title>ClickHouse too many partitions: why over-partitioning multiplies your part count</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-partitions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-partitions/</guid><description>&lt;h1 id="clickhouse-too-many-partitions-why-over-partitioning-multiplies-your-part-count">ClickHouse too many partitions: why over-partitioning multiplies your part count&lt;/h1>
&lt;p>You are watching &lt;code>MaxPartCountForPartition&lt;/code> climb, or you have already seen &lt;code>DB::Exception: Too many parts&lt;/code>. You check the table and see a modest total of active parts. The table looks healthy, but ClickHouse rejects inserts anyway.&lt;/p>
&lt;p>The problem is not the table total. It is the partition boundary.&lt;/p>
&lt;p>ClickHouse enforces part limits per partition, not per table. A high-cardinality &lt;code>PARTITION BY&lt;/code> key like &lt;code>toYYYYMMDD(timestamp)&lt;/code> or a business identifier creates thousands of isolated part pools. Parts never merge across those pools. One hundred partitions with thirty parts each produces 3,000 parts, multiplied merge-scheduling overhead, and higher file-descriptor pressure. One partition crossing the hard limit kills inserts for that partition while the rest of the table appears idle.&lt;/p></description></item><item><title>ClickHouse Too many simultaneous queries: max_concurrent_queries and query storms</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-simultaneous-queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-too-many-simultaneous-queries/</guid><description>&lt;h1 id="clickhouse-too-many-simultaneous-queries-max_concurrent_queries-and-query-storms">ClickHouse Too many simultaneous queries: max_concurrent_queries and query storms&lt;/h1>
&lt;p>You run a query and ClickHouse returns &amp;ldquo;Too many simultaneous queries.&amp;rdquo; New connections either queue or fail outright. Queries that completed in seconds yesterday now time out. The server is not down, but it is not usable.&lt;/p>
&lt;p>ClickHouse is optimized for fewer, heavier analytical queries. As concurrency rises, CPU, memory, and I/O contention increase non-linearly. A small spike can become a storm because each query is greedy.&lt;/p></description></item><item><title>ClickHouse TTL not deleting data: why expired rows survive and the disk fills</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-ttl-not-deleting-data/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-ttl-not-deleting-data/</guid><description>&lt;h1 id="clickhouse-ttl-not-deleting-data-why-expired-rows-survive-and-the-disk-fills">ClickHouse TTL not deleting data: why expired rows survive and the disk fills&lt;/h1>
&lt;p>A MergeTree table with a configured TTL can still accumulate disk usage when expired rows remain visible to &lt;code>SELECT&lt;/code>. This is not a syntax or timezone error. ClickHouse enforces TTL only as a side effect of background merges. When merges stop or never start, TTL stops, and storage grows without warning.&lt;/p>
&lt;h2 id="what-this-means">What this means&lt;/h2>
&lt;p>ClickHouse evaluates TTL expressions only during merge operations. When the merge scheduler combines parts, it checks whether rows exceeded their TTL interval. Depending on table settings, it either drops the entire part if every row expired, or rewrites the part to exclude expired rows. Both paths require a merge. If the background merge pool is saturated, disk space is too low for temporary merge output, or a partition has no new inserts to trigger merge selection, expired rows remain indefinitely. The system does not log a warning for TTL skips; the only visible symptom is growing storage.&lt;/p></description></item><item><title>ClickHouse unauthorized DROP TABLE: auditing DDL and privilege anomalies</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-unauthorized-ddl-drop-table/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-unauthorized-ddl-drop-table/</guid><description>&lt;h1 id="clickhouse-unauthorized-drop-table-auditing-ddl-and-privilege-anomalies">ClickHouse unauthorized DROP TABLE: auditing DDL and privilege anomalies&lt;/h1>
&lt;p>A production table disappears. An application returns &amp;ldquo;table does not exist.&amp;rdquo; In ClickHouse, DROP TABLE removes the table definition and MergeTree data parts from disk immediately. On replicated tables, a single &lt;code>ON CLUSTER&lt;/code> command propagates through the coordination service and can erase the table everywhere before you intervene. There is no native undo.&lt;/p>
&lt;p>This guide is for finding out what happened, determining blast radius, and closing the gaps.&lt;/p></description></item><item><title>ClickHouse ZooKeeper session has expired: causes, recovery, and tuning</title><link>https://www.netdata.cloud/guides/clickhouse/clickhouse-zookeeper-session-expired/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/clickhouse-zookeeper-session-expired/</guid><description>&lt;h1 id="clickhouse-zookeeper-session-has-expired-causes-recovery-and-tuning">ClickHouse ZooKeeper session has expired: causes, recovery, and tuning&lt;/h1>
&lt;p>When &lt;code>system.replicas&lt;/code> shows &lt;code>is_session_expired = 1&lt;/code>, the replica has lost its ZooKeeper session and stopped participating in replication. It rejects inserts, coordinated merges, and distributed DDL. Depending on quorum and load-balancer configuration, writes may shift silently to other replicas or halt for entire shards.&lt;/p>
&lt;p>&lt;code>is_session_expired&lt;/code> often appears alongside &lt;code>is_readonly = 1&lt;/code>, but the two are distinct. Session expiration means the coordination session is dead. Read-only means the replica refuses writes. Session expiration is the most severe because it breaks the replica&amp;rsquo;s contract with the cluster.&lt;/p></description></item><item><title>How ClickHouse actually works in production: a mental model for operators</title><link>https://www.netdata.cloud/guides/clickhouse/how-clickhouse-works-in-production/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.netdata.cloud/guides/clickhouse/how-clickhouse-works-in-production/</guid><description>&lt;h1 id="how-clickhouse-actually-works-in-production-a-mental-model-for-operators">How ClickHouse actually works in production: a mental model for operators&lt;/h1>
&lt;p>ClickHouse is a column-oriented OLAP database built around the MergeTree family of table engines. It does not fail like a transactional database. Its failure modes are distinctive and almost always originate in the storage layer rather than the query layer. In production, most incidents begin as storage-structure debt: immutable data parts accumulate faster than background processes can consolidate them. By the time queries slow down or inserts fail, the underlying merge crisis has been developing for hours.&lt;/p></description></item></channel></rss>