<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Beyond the code on Medium]]></title>
        <description><![CDATA[Stories by Beyond the code on Medium]]></description>
        <link>https://medium.com/@beyond_code?source=rss-600c0ed9ba10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*83POZtpxrlqBhlYS4MkdFg.jpeg</url>
            <title>Stories by Beyond the code on Medium</title>
            <link>https://medium.com/@beyond_code?source=rss-600c0ed9ba10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:07:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@beyond_code/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Securing a 3-Node ClickHouse Cluster with TLS: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@beyond_code/securing-a-3-node-clickhouse-cluster-with-tls-a-step-by-step-guide-a41a32b53ea2?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/a41a32b53ea2</guid>
            <category><![CDATA[tls-certificate]]></category>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[database-security]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 06:38:12 GMT</pubDate>
            <atom:updated>2026-11-04T08:06:01.786Z</atom:updated>
            <content:encoded><![CDATA[<p>Out of the box, ClickHouse talks to clients and to its own replicas in plain text. That means every query, every result set, and every byte of replicated data crosses your network unencrypted.</p><p>In this guide, we’ll fix that for a production cluster with <strong>1 shard and 3 replicas</strong>. We’ll create our own private Certificate Authority (CA), issue a unique certificate for each node, configure ClickHouse to use them, and roll the change out <strong>without downtime</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*92KIlgERzt8yTGlSd2GhSw.png" /></figure><h3>Why TLS matters for your ClickHouse cluster</h3><p>TLS is not a nice-to-have for a production database. Here is what it protects you from:</p><ul><li><strong>Data exposure in transit.</strong> Without TLS, anyone who can sniff traffic on your network (a compromised host, a misconfigured VPC, a shared switch) can read queries, results and credentials. ClickHouse passwords sent over plain HTTP or native TCP are visible on the wire.</li><li><strong>Unprotected replication.</strong> Replicas constantly fetch data parts from each other over the interserver port. On a plain-text setup, your entire dataset is copied across the network unencrypted, repeatedly.</li><li><strong>Impersonation (man-in-the-middle).</strong> Certificates let each node prove its identity. With verification enabled, a rogue machine cannot pretend to be ch-node2 and receive replicated data or client queries.</li><li><strong>Compliance.</strong> Standards such as GDPR, HIPAA, PCI DSS and SOC 2 expect sensitive data to be encrypted in transit. TLS is often the first thing an auditor checks.</li><li><strong>Zero-trust networks.</strong> “It’s on a private network” is no longer a defence. Modern security practice assumes the internal network can be compromised, so every hop should be encrypted and authenticated.</li></ul><p>The good news: you don’t need to buy certificates. For internal cluster traffic, a private CA you control is simple, free and fully secure.</p><h3>The setup</h3><p>We’ll use these example nodes. Replace them with your real hostnames and IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WIh0lGf27dpku3iVikmsTg.png" /><figcaption>3-Node Cluster</figcaption></figure><p>The plan in one line: one private CA signs three node certificates; every node trusts that CA, so every node trusts the others.</p><p>You’ll need OpenSSL 3.0 or newer on the machine where you generate certificates (the -copy_extensions flag used below doesn&#39;t exist in OpenSSL 1.1). Check with openssl version.</p><h3>Step 1: Create your private Certificate Authority</h3><p>Generate the CA once, on a single trusted machine — not on each ClickHouse node.</p><pre>mkdir clickhouse-tls<br>cd clickhouse-tls<br><br># CA private key<br>openssl genrsa -out ca.key 4096<br><br># CA certificate, valid for 10 years<br>openssl req -x509 -new -key ca.key \<br>  -sha256 -days 3650 \<br>  -out ca.crt \<br>  -subj &quot;/CN=ClickHouse-Internal-CA&quot;</pre><p>You now have two files:</p><ul><li>ca.key — the private key that signs certificates. This is the crown jewel. Anyone holding it can issue certificates your cluster will trust.</li><li>ca.crt — the public CA certificate you&#39;ll distribute to every node.</li></ul><p><strong>Never copy </strong><strong>ca.key to the ClickHouse nodes.</strong> Store it offline or in a secrets manager.</p><h3>Step 2: Issue a certificate for each node</h3><p>On the same machine, create a key and a certificate signing request (CSR) for each node, then sign it with your CA. Here’s Node 1:</p><pre>openssl req -new -newkey rsa:2048 -nodes \<br>  -keyout node1.key \<br>  -out node1.csr \<br>  -subj &quot;/CN=ch-node1.example.com&quot; \<br>  -addext &quot;subjectAltName=DNS:ch-node1.example.com,IP:10.0.0.1&quot;<br><br>openssl x509 -req \<br>  -in node1.csr \<br>  -CA ca.crt \<br>  -CAkey ca.key \<br>  -CAcreateserial \<br>  -out node1.crt \<br>  -days 365 \<br>  -sha256 \<br>  -copy_extensions copy</pre><p>Repeat for Node 2 and Node 3, changing the file names, hostname and IP. Or do all three in one loop:</p><pre>for i in 1 2 3; do<br>  openssl req -new -newkey rsa:2048 -nodes \<br>    -keyout node$i.key -out node$i.csr \<br>    -subj &quot;/CN=ch-node$i.example.com&quot; \<br>    -addext &quot;subjectAltName=DNS:ch-node$i.example.com,IP:10.0.0.$i&quot;<br><br>  openssl x509 -req -in node$i.csr \<br>    -CA ca.crt -CAkey ca.key -CAcreateserial \<br>    -out node$i.crt -days 365 -sha256 \<br>    -copy_extensions copy<br>done</pre><p>Why this matters:</p><ul><li><strong>Subject Alternative Name (SAN)</strong> is what modern TLS clients actually check. The CN alone is ignored by most clients today. Include every name and IP that clients or other replicas use to reach the node.</li><li>-copy_extensions copy carries the SAN from the CSR into the signed certificate. Without it, the SAN is silently dropped and hostname verification fails.</li><li><strong>One key per node</strong> means a compromised node can be revoked without touching the others.</li></ul><h3>Step 3: Verify before you deploy</h3><p>Catching a bad certificate here takes seconds. Catching it after a restart can take a replica offline.</p><pre>openssl verify -CAfile ca.crt node1.crt node2.crt node3.crt</pre><p>Expected output:</p><pre>node1.crt: OK<br>node2.crt: OK<br>node3.crt: OK</pre><p>Then confirm the hostname and IP made it into each certificate:</p><pre>openssl x509 -in node1.crt -noout -ext subjectAltName</pre><p>You should see DNS:ch-node1.example.com, IP Address:10.0.0.1. Repeat for the other nodes.</p><h3>Step 4: Copy certificates to each node</h3><p>Each node gets only three files: the shared CA certificate plus its own certificate and key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1LEHRtAz_UQZHz27AZtPQ.png" /></figure><p>From your secure machine:</p><pre>scp ca.crt node1.crt node1.key user@10.0.0.1:/tmp/</pre><p>Then on Node 1:</p><pre>sudo mkdir -p /etc/clickhouse-server/certs<br>sudo mv /tmp/ca.crt /tmp/node1.crt /tmp/node1.key \<br>  /etc/clickhouse-server/certs/</pre><p>Lock down ownership and permissions on every node, so only the clickhouse user can read the private key:</p><pre>sudo chown -R clickhouse:clickhouse /etc/clickhouse-server/certs<br>sudo chmod 700 /etc/clickhouse-server/certs<br>sudo chmod 600 /etc/clickhouse-server/certs/*</pre><p>Repeat for Nodes 2 and 3 with their own files. Delete the copies left in /tmp and the .csr files once you&#39;re done.</p><h3>Step 5: Configure TLS in ClickHouse</h3><p>On each node, create /etc/clickhouse-server/config.d/ssl.xml. This is Node 1:</p><pre>&lt;clickhouse&gt;<br>    &lt;https_port&gt;8443&lt;/https_port&gt;<br>    &lt;tcp_port_secure&gt;9440&lt;/tcp_port_secure&gt;<br>    &lt;interserver_https_port&gt;9010&lt;/interserver_https_port&gt;</pre><pre>    &lt;openSSL&gt;<br>        &lt;server&gt;<br>            &lt;certificateFile&gt;/etc/clickhouse-server/certs/node1.crt&lt;/certificateFile&gt;<br>            &lt;privateKeyFile&gt;/etc/clickhouse-server/certs/node1.key&lt;/privateKeyFile&gt;<br>            &lt;caConfig&gt;/etc/clickhouse-server/certs/ca.crt&lt;/caConfig&gt;<br>            &lt;verificationMode&gt;relaxed&lt;/verificationMode&gt;<br>        &lt;/server&gt;</pre><pre>        &lt;client&gt;<br>            &lt;caConfig&gt;/etc/clickhouse-server/certs/ca.crt&lt;/caConfig&gt;<br>            &lt;verificationMode&gt;strict&lt;/verificationMode&gt;<br>        &lt;/client&gt;<br>    &lt;/openSSL&gt;<br>&lt;/clickhouse&gt;</pre><p>For Node 2 and Node 3, change only the certificate and key paths. The CA path stays the same everywhere.</p><p>What each part does:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHjbJjaoDuv0B6vI2dWdFg.png" /><figcaption>Ports &amp; Purpose</figcaption></figure><p><strong>A note on </strong><strong>verificationMode.</strong> On the &lt;server&gt; side, strict forces <em>every</em> client to present its own client certificate. Your curl test, BI tools and apps would all be rejected unless you also issue them client certificates. Use relaxed on the server unless you&#39;re deliberately setting up mutual TLS. On the &lt;client&gt; side, strict is what you want: it makes the node refuse to talk to a replica whose certificate isn&#39;t signed by your CA.</p><p><strong>If your cluster uses distributed queries</strong>, also set &lt;secure&gt;1&lt;/secure&gt; and &lt;port&gt;9440&lt;/port&gt; for each replica in your remote_servers config, so node-to-node queries use TLS too.</p><p>Finally, make sure the hostnames in your cluster config (remote_servers, interserver_http_host) match the names in the certificates. If they use IP addresses, those IPs must be in the SAN — which is why we added them in Step 2.</p><h3>Step 6: Restart one node at a time</h3><p>A rolling restart keeps two healthy replicas serving traffic while the third picks up its new config. Never restart all three at once.</p><p>First, check the XML is well-formed, since a typo will stop the server from starting:</p><pre>xmllint --noout /etc/clickhouse-server/config.d/ssl.xml</pre><p>Then restart Node 1 and watch it come up:</p><pre>sudo systemctl restart clickhouse-server<br>sudo systemctl status clickhouse-server<br>sudo journalctl -u clickhouse-server -n 100 --no-pager</pre><p>Also check /var/log/clickhouse-server/clickhouse-server.err.log for any SSL errors. Only when Node 1 is healthy and caught up on replication, move on to Node 2, then Node 3.</p><h3>Step 7: Test the encrypted connections</h3><p>Confirm the secure ports are listening on each node:</p><pre>sudo ss -lntp | grep -E &#39;8443|9440|9010&#39;</pre><p>Test the HTTPS interface from a client machine that has ca.crt:</p><pre>curl --cacert ca.crt https://ch-node1.example.com:8443/ping</pre><p>Expected response: Ok.</p><p>Test the native secure port:</p><pre>clickhouse-client \<br>  --host ch-node1.example.com \<br>  --port 9440 \<br>  --secure \<br>  --user default</pre><p>The client also needs to trust your CA. Add a &lt;caConfig&gt; pointing to ca.crt under &lt;openSSL&gt;&lt;client&gt; in the client&#39;s config file (for example ~/.clickhouse-client/config.xml), or install ca.crt into the machine&#39;s system trust store.</p><h3>Step 8: Verify the cluster is replicating</h3><p>TLS working on one connection isn’t enough. Confirm replicas are still fetching parts from each other over the new encrypted interserver port:</p><pre>SELECT<br>    hostName() AS node,<br>    database,<br>    table,<br>    is_readonly,<br>    is_session_expired,<br>    queue_size,<br>    absolute_delay<br>FROM clusterAllReplicas(&#39;your_cluster&#39;, system.replicas);</pre><p>Healthy replicas show is_readonly = 0, is_session_expired = 0, and a queue_size and absolute_delay that stay low rather than growing. A growing queue usually means replicas can&#39;t fetch parts from each other — check the error log for certificate or hostname mismatch errors.</p><h3>Common pitfalls and best practices</h3><ul><li><strong>Keep the old ports open during migration.</strong> Leave the plain-text ports (8123, 9000, 9009) running until every application, ingestion pipeline and replica has moved to the TLS ports. Then disable them.</li><li><strong>Put expiry on your calendar.</strong> Node certificates here last 365 days. An expired certificate breaks replication without warning. Set a reminder at least 30 days before, or automate renewal.</li><li><strong>Protect the CA key.</strong> If ca.key leaks, an attacker can mint trusted certificates. Keep it offline or in a vault.</li><li><strong>Hostname mismatches are the #1 failure.</strong> If a replica connects using a name or IP that isn’t in the SAN, the handshake fails. Check openssl x509 -ext subjectAltName first when debugging.</li><li><strong>Don’t forget ClickHouse Keeper / ZooKeeper.</strong> Coordination traffic is a separate connection. Secure it too for full encryption in transit.</li><li><strong>Add a new node later?</strong> Just repeat Steps 2–5 for it. Your existing nodes already trust the CA, so no changes are needed on them.</li></ul><h3>Wrapping up</h3><p>In about thirty minutes, your ClickHouse cluster went from sending everything in plain text to encrypting client queries, HTTP traffic and replication between all three replicas, with zero downtime thanks to a rolling restart.</p><p>The pattern is simple to remember: <strong>one CA, one certificate per node, verify before you deploy, restart one node at a time.</strong></p><p>If this guide helped, give it a clap and follow for more ClickHouse and data-engineering posts. Questions or a different setup? Drop them in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a41a32b53ea2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ClickHouse Releases Explained: Monthly Versions, LTS, and What Changed in 2026]]></title>
            <link>https://medium.com/@beyond_code/clickhouse-releases-explained-monthly-versions-lts-and-what-changed-in-2026-15a4bf208dc3?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/15a4bf208dc3</guid>
            <category><![CDATA[version]]></category>
            <category><![CDATA[clickhouse-cloud]]></category>
            <category><![CDATA[clickhouse]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 15:07:42 GMT</pubDate>
            <atom:updated>2026-10-06T15:07:42.404Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started working with ClickHouse, one thing confused me more than I expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Enex5CsasSHhabxKPrNB5Q.png" /></figure><p>The version numbers.</p><p>You see releases like:</p><pre>26.1<br>26.2<br>26.3<br>26.4<br>...<br>26.9</pre><p>And then suddenly you see:</p><pre>26.3 LTS<br>26.8 LTS</pre><p>Then there are patch versions such as:</p><pre>26.8.3<br>26.8.4</pre><p>At first, it is easy to wonder:</p><p><strong>Why are there so many versions? Which one should I actually use in production? And what&#39;s the difference between a normal release and LTS?</strong></p><p>After spending more time with ClickHouse, I realized that understanding its release model is actually important if you&#39;re running ClickHouse in a real environment.</p><p>So I decided to break it down.</p><h3>First: Why Does ClickHouse Release So Often?</h3><p>ClickHouse follows a pretty fast release cycle.</p><p>Instead of waiting for a large “major version” every couple of years, ClickHouse generally ships a new feature release every month.</p><p>So:</p><p><strong>26.1</strong> → January 2026<br><strong>26.2</strong> → February 2026<br><strong>26.3</strong> → March 2026</p><p>And so on.</p><p>That makes the version number surprisingly easy to understand once you know the pattern.</p><p>The first number represents the year.</p><p>The second number represents the month.</p><p>So:</p><blockquote><strong><em>26.9 = September 2026</em></strong></blockquote><p>You may also see a longer version such as:</p><pre>26.9.4.3</pre><p>The additional numbers identify the patch/build level of that release branch.</p><p>This monthly model is one of the things I find interesting about ClickHouse.</p><p>You don’t have to wait six months or a year to see improvements.</p><p>There’s a new release almost every month.</p><p>But there is a catch.</p><p><strong>You probably don’t want to upgrade your production cluster every month.</strong></p><p>And that’s where LTS comes in.</p><h3>So, What Is LTS?</h3><p>LTS stands for:</p><p><strong>Long-Term Support.</strong></p><p>ClickHouse designates certain releases as LTS releases, generally around twice a year, typically in March and August.</p><p>In 2026, the LTS releases are:</p><ul><li><strong>26.3</strong></li><li><strong>26.8</strong></li></ul><p>The monthly releases are where you get the newest features and optimizations quickly.</p><p>The LTS releases are more attractive when your priority is <strong>stability and a longer upgrade cycle</strong>. For example, 26.3 LTS is listed as supported until March 2027.</p><p>For a production database, that distinction matters a lot.</p><h3>A Quick Look at the 2026 Release Timeline</h3><p>2026 has been a busy year for ClickHouse. Here’s the whole year at a glance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IcXxX82mdbc79zCZEQbRHg.png" /><figcaption>01_timeline.png — the 2026 release timeline, LTS releases highlighted</figcaption></figure><p>Two releases stand out:</p><p><strong>26.3 LTS</strong> and <strong>26.8 LTS</strong></p><p>The rest are regular monthly releases.</p><p>And if you’re following ClickHouse closely, the amount of change between these releases is pretty impressive.</p><h3>Why Not Just Run the Latest Version?</h3><p>This was one of the things I started thinking about once I moved from simply learning ClickHouse to actually working with it.</p><p>The newest version isn’t automatically the best version for every environment.</p><p>Imagine you’re running a production cluster with:</p><ul><li>Multiple nodes</li><li>Replication</li><li>ClickHouse Keeper</li><li>CDC pipelines</li><li>Materialized views</li><li>BI dashboards</li><li>Scheduled queries</li><li>Applications depending on the database</li></ul><p>An upgrade isn’t just:</p><pre>apt upgrade clickhouse</pre><p>and you’re done.</p><p>You need to think about:</p><ul><li>Compatibility</li><li>Backward-incompatible changes</li><li>Query behavior</li><li>Performance changes</li><li>Replication</li><li>Client compatibility</li><li>Materialized views</li><li>Storage</li><li>Rollback possibilities</li></ul><p>This is why LTS releases can be very attractive for production environments.</p><h3>What Actually Changed in 2026?</h3><p>This is where things get interesting.</p><p>Rather than trying to list every change, let’s look at some of the changes that caught my attention.</p><h4>26.1: Starting the Year Strong</h4><p>The January release, <strong>26.1</strong>, included:</p><ul><li>25 new features</li><li>43 performance optimizations</li><li>176 bug fixes</li></ul><p>Some of the interesting changes included improvements around asynchronous inserts, projections, Variant support, and query scheduling.</p><p>One thing I particularly like about looking at release notes this way is that it reminds you that a ClickHouse release isn’t just about adding shiny new SQL syntax.</p><p>A significant part of the work goes into making existing workloads faster and more reliable.</p><h4>26.2: More Attention to Text and Joins</h4><p>February’s <strong>26.2</strong> release brought improvements including:</p><ul><li>Production-ready text indexes</li><li>Production-ready QBit data type</li><li>Faster RIGHT JOIN and FULL OUTER JOIN</li><li>Automatic minmax indexes for temporal columns</li></ul><p>This is a good example of how ClickHouse keeps expanding beyond its traditional analytical database use cases.</p><h4>26.3: First LTS of 2026</h4><p>Then came <strong>26.3</strong>, the first LTS release of the year.</p><p>Some notable changes included:</p><ul><li>Async inserts enabled by default</li><li>MATERIALIZED support for CTEs</li><li>Improvements to JOIN reordering</li><li>Various SQL behavior changes and fixes</li></ul><p>But this release also highlights why reading the changelog matters before upgrading.</p><p>Some changes were backward-incompatible.</p><p>For example, there were changes around SQL behavior and certain experimental features.</p><p>There was also an important downgrade consideration involving data written with nested types.</p><p>That’s a good reminder:</p><blockquote><strong><em>An upgrade isn’t complete when the new binary starts. It’s complete when your workloads have been validated.</em></strong></blockquote><h4>26.4: Better Query Experience</h4><p>April’s <strong>26.4</strong> release brought improvements such as:</p><ul><li>Faster COUNT DISTINCT</li><li>Improvements to EXPLAIN</li><li>VALUES table expressions</li><li>PostgreSQL-style units in EXTRACT</li><li>Text-index acceleration for LIKE queries</li></ul><p>The EXPLAIN improvements are particularly interesting for anyone who spends time troubleshooting query performance.</p><p>Because eventually, you stop asking:</p><blockquote><em>“Why is this query slow?”</em></blockquote><p>and start asking:</p><blockquote><em>“What is ClickHouse actually doing with this query?”</em></blockquote><h4>26.5: Query Optimization Gets Interesting</h4><p>In <strong>26.5</strong>, one of the changes that stood out was the ability to push:</p><pre>ORDER BY ... LIMIT</pre><p>through joins in certain situations.</p><p>The release notes reported speedups of up to 20× for relevant workloads.</p><p>There were also improvements around:</p><pre>GROUP BY ... LIMIT</pre><p>and additional SQL functionality.</p><p>This is the kind of optimization that can make a surprisingly large difference without requiring you to redesign your entire database.</p><h4>26.6: ClickHouse Turns 10</h4><p>June’s <strong>26.6</strong> release was a special one.</p><p>ClickHouse celebrated its <strong>10-year anniversary as an open-source project</strong>.</p><p>And the release itself was substantial:</p><ul><li>56 new features</li><li>79 performance optimizations</li><li>366 bug fixes</li></ul><p>Some interesting additions included:</p><ul><li>Hypothetical skip indexes</li><li>Cascading refreshable materialized views</li><li>Experimental continuous queries</li><li>Improvements to Keeper</li><li>Distributed shuffle support</li></ul><p>The hypothetical skip index feature is particularly interesting from a performance-engineering perspective.</p><p>Instead of immediately building an index and hoping it helps, you can explore what the potential impact could be.</p><p>That kind of feature reflects something I increasingly appreciate about ClickHouse:</p><p><strong>performance isn’t treated as an afterthought.</strong></p><h4>26.7: More Focus on Performance</h4><p>Then came <strong>26.7</strong> in July.</p><p>This release crossed an interesting milestone:</p><p><strong>more than 100 performance optimizations.</strong></p><p>Some of the highlights included:</p><ul><li>Better JOIN filtering</li><li>New join-reordering algorithms</li><li>Faster regular expression processing</li><li>Vector search improvements</li></ul><p>The ClickHouse team also demonstrated some very large speedups when combining multiple query optimizations.</p><p>And this is something worth paying attention to.</p><p>A single optimization might give you 10%.</p><p>But several optimizations working together can sometimes completely change the shape of a workload.</p><h4>26.8: The Second LTS</h4><p>August brought <strong>26.8</strong>, the second LTS release of 2026.</p><p>This was another large release:</p><ul><li>98 new features</li><li>128 performance optimizations</li><li>556 bug fixes</li></ul><p>Some of the changes included:</p><ul><li>Background queries</li><li>Pipelined SQL</li><li>New text tokenizers</li><li>Data lake integrations</li><li>Faster Parquet processing</li><li>GROUP BY improvements</li><li>JOIN improvements</li></ul><p>The background query feature caught my attention because it addresses a practical problem.</p><p>What happens when you start a long-running analytical query and then your client disconnects?</p><p>With background query support, the work can continue independently.</p><p>That’s a very production-oriented improvement.</p><h4>26.9: The Latest Release</h4><p>And then we arrive at <strong>26.9</strong>, released in September.</p><p>This release included:</p><ul><li>56 new features</li><li>135 performance optimizations</li><li>464 bug fixes</li></ul><p>Some interesting additions:</p><p><strong>Incremental refreshes</strong> — particularly interesting for append-only workloads and materialized views.</p><p><strong>Disk spilling for high-cardinality DISTINCT</strong> — useful for workloads where keeping everything in memory isn’t practical.</p><p><strong>CREATE TOKEN</strong> — allows time-limited credentials.</p><p><strong>PromQL improvements</strong> — interesting if you’re working with ClickHouse alongside Prometheus and observability tooling.</p><h3>Looking at the Numbers</h3><p>When you put the releases next to each other, an interesting pattern appears.</p><p>Performance optimizations grew from 43 in 26.1 to 79 in 26.6, passed 100 in 26.7, and reached 128 in 26.8 and 135 in 26.9.</p><p>Bug fixes grew too, from 176 in 26.1 to 556 in 26.8, with 464 in 26.9.</p><p>The exact counts vary slightly depending on which ClickHouse release material you look at, but the overall trend is clear.</p><p><strong>Performance remains a major focus.</strong></p><p>For someone operating ClickHouse in production, that’s an important part of the story.</p><p>A release isn’t just:</p><blockquote><em>“Here are 50 new features.”</em></blockquote><p>It’s also:</p><blockquote><em>“Here are hundreds of fixes and optimizations that could affect the workloads you’re already running.”</em></blockquote><h3>So Which Version Should You Choose?</h3><p>This is probably the question that brought you here.</p><p>There isn’t one answer for everyone.</p><h4>If you’re running a production environment</h4><p>I’d generally look toward the current LTS branch.</p><p>At the time of writing:</p><p><strong>26.8 LTS</strong></p><p>is the natural production-oriented choice among the 2026 releases.</p><h4>If you’re testing new features</h4><p>The latest monthly stable release is more interesting.</p><p>At the time of writing:</p><p><strong>26.9</strong></p><p>is the latest monthly branch.</p><p>This gives you access to newer functionality, but it also means accepting a faster upgrade cadence.</p><h4>If you’re learning ClickHouse</h4><p>I’d personally recommend using a recent version.</p><p>You’re going to encounter newer syntax, features, and behavior in current documentation and community discussions.</p><h3>One Command I Always Start With</h3><p>Before investigating any version-specific behavior, find out what you’re actually running.</p><pre>SELECT version();</pre><p>It sounds obvious.</p><p>But in a real environment, knowing the exact version matters.</p><p>Because when something behaves differently from what you expect, the first question should be:</p><blockquote><strong><em>Which ClickHouse version am I running?</em></strong></blockquote><h3>What About Upgrading?</h3><p>This is where I would be cautious.</p><p>Never treat a production ClickHouse upgrade as just a package upgrade.</p><p>Before upgrading, I would check:</p><h4>1. Release notes</h4><p>Look specifically for:</p><ul><li>Backward Incompatible Changes</li><li>Breaking Changes</li><li>Deprecated Features</li><li>Changed Defaults</li></ul><h4>2. Query compatibility</h4><p>Test your important queries.</p><p>Especially:</p><ul><li>Large aggregations</li><li>JOIN-heavy queries</li><li>Materialized views</li><li>Distributed queries</li><li>FINAL</li><li>Mutations</li></ul><h4>3. Data compatibility</h4><p>Make sure the new version can read your existing data correctly.</p><h4>4. Replication</h4><p>If you’re running replicated tables, validate replica behavior after the upgrade.</p><h4>5. Rollback strategy</h4><p>Don’t discover your rollback plan after something breaks.</p><h3>One Thing I Learned From Following Releases</h3><p>The more I work with ClickHouse, the more I realize that <strong>version numbers aren’t just labels</strong>.</p><p>They tell you something about the direction the database is moving.</p><p>One release might focus heavily on query performance.</p><p>Another might introduce new indexing capabilities.</p><p>Another might improve observability.</p><p>Another might expand data lake integrations.</p><p>And over time, these small improvements add up.</p><p>That’s why I find the ClickHouse release cycle interesting.</p><p>You’re not waiting for one huge transformation every few years.</p><p>You’re watching the database evolve continuously.</p><h3>Monthly Releases or LTS?</h3><p>For me, the easiest way to think about it is:</p><p><strong>Monthly releases</strong></p><ul><li>Latest features</li><li>Latest optimizations</li><li>Faster changes</li><li>More experimentation</li></ul><p><strong>LTS releases</strong></p><ul><li>Stability</li><li>Longer lifecycle</li><li>Fewer upgrades</li><li>Production focus</li></ul><p>Neither is universally better.</p><p>It depends on how much change your environment can absorb.</p><p>If you’re experimenting, learning, or evaluating new capabilities, the monthly releases are exciting.</p><p>If you’re running a large production environment where stability matters more than having the newest feature immediately, LTS is often the more comfortable path.</p><h3>The Bigger Picture</h3><p>One thing I appreciate about ClickHouse is that its release strategy reflects the character of the project itself.</p><p>It’s moving quickly.</p><p>New features arrive constantly.</p><p>Performance keeps improving.</p><p>And the database continues expanding into areas like:</p><ul><li>Vector search</li><li>Text search</li><li>Data lakes</li><li>Observability</li><li>Streaming</li><li>Advanced analytical workloads</li></ul><p>But that speed also means we, as engineers, need to be thoughtful about upgrades.</p><p><strong>Don’t upgrade just because a new version exists.</strong></p><p>Understand what changed.</p><p>Test your workloads.</p><p>Read the breaking changes.</p><p>And decide whether the new version actually solves a problem you have.</p><p>For production systems, the newest version isn’t always the smartest version.</p><p>Sometimes the smartest choice is the version you have tested thoroughly and know how to operate.</p><h3>Final Thought</h3><p>When I first saw ClickHouse releases, I saw a long list of version numbers.</p><p>Now I see something different.</p><p>I see a database evolving month by month.</p><p><strong>26.1 → 26.2 → 26.3 LTS → … → 26.8 LTS → 26.9</strong></p><p>Each release is another step in that evolution.</p><p>And if you’re working with ClickHouse, keeping an eye on that evolution isn’t just interesting.</p><p>It can directly influence how you design, operate, troubleshoot, and upgrade your production systems.</p><p>That’s probably the most useful reason to follow the release notes.</p><p>Not to know <strong>what’s new</strong>.</p><p>But to understand <strong>what could change the way you work with ClickHouse</strong>.</p><p><em>Sources: ClickHouse’s official release announcements and changelog, plus release lifecycle information from endoflife.date and supporting upgrade documentation.</em></p><p><em>This article reflects the ClickHouse release information available as of early October 2026. Release details and support timelines can change, so check the latest official changelog before making a production upgrade decision.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15a4bf208dc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Updates, Deletes and Mutations in ClickHouse: Why They Work Differently Than You Expect]]></title>
            <link>https://medium.com/@beyond_code/updates-deletes-and-mutations-in-clickhouse-why-they-work-differently-than-you-expect-22d854d0824a?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/22d854d0824a</guid>
            <category><![CDATA[clickhousedb]]></category>
            <category><![CDATA[clickhouse-cloud]]></category>
            <category><![CDATA[clickhouse]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Thu, 24 Sep 2026 06:58:32 GMT</pubDate>
            <atom:updated>2026-09-24T06:58:32.152Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve spent time with PostgreSQL or MySQL, UPDATE and DELETE feel like simple, cheap operations. You touch a few rows, the database changes them in place, and you move on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2r3V13eeAspLnU2yLwO8Q.png" /><figcaption>Illustration of Cover Page</figcaption></figure><p>Bring that mental model into ClickHouse and you will eventually get burned.</p><p>We already established the key fact back in the MergeTree article: <strong>data parts are immutable.</strong> Once a part is written, ClickHouse never edits its bytes in place.</p><p>So what actually happens when you run this?<br>ALTER TABLE spend<br>UPDATE amount = amount * 1.1<br>WHERE customer_id = 102;</p><p>That’s what this article is about.</p><h3>1. The Core Rule: Nothing Is Edited in Place</h3><p>Every part on disk is treated as read-only once it’s written. Not “hard to change” — genuinely never modified.</p><p>That single rule explains almost everything else in this article. If a part can’t be edited, then an UPDATE or DELETE has to produce <strong>new parts</strong> instead — which is exactly what a <strong>mutation</strong> does.</p><h3>2. What ALTER TABLE UPDATE / DELETE Actually Are</h3><p>In ClickHouse, ALTER TABLE ... UPDATE and ALTER TABLE ... DELETE are not instant, in-place statements. They&#39;re <strong>mutations</strong> — asynchronous background jobs that ClickHouse queues up and processes over time.</p><pre>ALTER TABLE spend<br>UPDATE amount = amount * 1.1<br>WHERE customer_id = 102;</pre><p>The moment you run this, ClickHouse doesn’t go find 200 rows and tweak them. It does something much bigger:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*x1F1OnP8r0sCAmkXiZQyag.png" /><figcaption>mutation_flow</figcaption></figure><ol><li>The mutation is added to a queue (visible in system.mutations).</li><li>ClickHouse identifies every <strong>part</strong> that could contain a row matching WHERE customer_id = 102.</li><li>For each matched part, it reads the <strong>entire part</strong> — every column, every row — and rewrites it with the update applied.</li><li>The result is a brand-new part.</li><li>The new part becomes active; the old one is marked inactive.</li><li>The old part is physically deleted later, once nothing needs it anymore.</li></ol><p>Notice step 3. That’s the part that surprises people.</p><h3>3. Why This Is More Expensive Than It Looks</h3><p>Say your WHERE customer_id = 102 matches 200 rows out of 4 million in a part. You might expect ClickHouse to touch roughly 200 rows&#39; worth of data.</p><p>It doesn’t. It rewrites the <strong>whole part</strong> — every column, including the ones the UPDATE never touched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0g8_YwhVBCMmBPH8-I0S0Q.png" /><figcaption>cost_illustration</figcaption></figure><p>This is a direct consequence of the immutable, columnar, part-based design we’ve covered in every article so far. ClickHouse doesn’t have a mechanism to edit “just these 200 rows” or “just this one column” inside an existing part — parts are atomic units. Changing anything about a part means producing a new one.</p><p>So the cost of a mutation is proportional to:</p><ul><li>The size of the parts it touches (not the number of matching rows)</li><li>The number of columns in the table (all of them get rewritten, not just the updated one)</li><li>How many parts the WHERE clause&#39;s condition fails to prune</li></ul><p>A tiny UPDATE on a huge, wide table can mean rewriting gigabytes of data to change a handful of values.</p><h3>4. Watching a Mutation Run</h3><p>Because mutations are asynchronous, you can watch them in progress:</p><pre>SELECT<br>    mutation_id,<br>    command,<br>    is_done,<br>    parts_to_do,<br>    latest_failed_part<br>FROM system.mutations<br>WHERE table = &#39;spend&#39;<br>ORDER BY create_time DESC;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1VXBKWjc0TxzmBqvaJedw.png" /><figcaption>system_mutations</figcaption></figure><p>While is_done = 0, old and new data can briefly coexist depending on timing, and queries may still see pre-mutation values until the relevant parts have been rewritten. This is different from a transactional UPDATE that&#39;s atomic the instant it commits.</p><p>If you need to cancel a runaway mutation, there’s a dedicated command for that too:</p><pre>KILL MUTATION WHERE mutation_id = &#39;...&#39;;</pre><h3>5. DELETE Works the Same Way — With One Newer Exception</h3><p>For a long time, ALTER TABLE ... DELETE was the only way to remove rows, and it followed exactly the mutation path above: find matching parts, rewrite them in full without the deleted rows, swap in the new parts.</p><pre>ALTER TABLE spend<br>DELETE WHERE customer_id = 102;</pre><p>That’s still a legitimate way to delete data — but it carries the same “rewrite the whole part” cost as UPDATE.</p><p>More recently, ClickHouse added <strong>lightweight deletes</strong>, which behave very differently:</p><pre>DELETE FROM spend<br>WHERE customer_id = 102;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1nGec0ryAOQduxVSGeoFlA.png" /><figcaption>lightweight_delete</figcaption></figure><p>Instead of rewriting parts immediately, ClickHouse marks the matching rows using a hidden _row_exists column. Queries stop seeing those rows right away, but the actual bytes stay on disk until a normal background merge eventually drops them for good.</p><h3>6. Mutation vs. Lightweight Delete, Side by Side</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87FoaTJ8caIvihbLEKfDFQ.png" /><figcaption>mutations_vs_lightweight</figcaption></figure><p>The short version: if you need to delete rows occasionally and want it to feel fast, lightweight DELETE is usually the better tool. If you&#39;re doing a rare, deliberate bulk correction and don&#39;t mind the cost, ALTER TABLE ... DELETE is fine too. Neither one is a good fit for deleting rows constantly, all day, as part of normal application traffic.</p><h3>7. The Anti-Pattern: Frequent Updates and Deletes</h3><p>Here’s the practical takeaway that matters most: <strong>ClickHouse is not designed for workloads that update or delete rows constantly.</strong></p><p>If your application pattern looks like:</p><ul><li>Updating a “status” column on the same rows repeatedly</li><li>Deleting rows as soon as they’re processed</li><li>Correcting values every few seconds as new information arrives</li></ul><p>…you will generate a steady stream of mutations, each one rewriting entire parts, competing with your background merges for CPU and I/O. This is a very different profile from the occasional, bulk UPDATE/DELETE mutations were designed for.</p><h3>8. What to Use Instead: Engines Built for Changing Data</h3><p>ClickHouse’s answer to “I need to model changing state” isn’t “mutate the row.” It’s “insert a new row that represents the current state, and let a specialized engine sort it out during merges.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikKeq9ujOFCzCYXRNutVJA.png" /><figcaption>engine_alternatives</figcaption></figure><p>For example, with ReplacingMergeTree, instead of:</p><pre>ALTER TABLE spend<br>UPDATE amount = 750<br>WHERE customer_id = 103;</pre><p>you would simply insert a new row for customer_id = 103 with a newer version/timestamp:</p><pre>CREATE TABLE spend<br>(<br>    customer_id UInt64,<br>    amount Decimal(18,2),<br>    updated_at DateTime<br>)<br>ENGINE = ReplacingMergeTree(updated_at)<br>ORDER BY customer_id;<br><br>INSERT INTO spend VALUES (103, 750, now());</pre><p>During background merges, ReplacingMergeTree keeps only the row with the latest updated_at per sorting key. No mutation, no rewriting unrelated columns, no waiting for a mutation queue — just an insert, which is the operation ClickHouse is built to do fast.</p><p>CollapsingMergeTree and VersionedCollapsingMergeTree follow a similar idea for cases where you need to &quot;cancel out&quot; a previous r</p><h3>9. A Simple Decision Guide</h3><ul><li><strong>Need to fix a handful of rows once, or run an occasional bulk correction?</strong> ALTER TABLE ... UPDATE/DELETE is fine — just expect it to take time proportional to part size, not row count.</li><li><strong>Need to delete rows relatively often, and want it to feel immediate?</strong> Use lightweight DELETE.</li><li><strong>Need to model rows that change constantly — status flags, running totals, “latest known state”?</strong> Don’t mutate. Reach for ReplacingMergeTree, CollapsingMergeTree, or VersionedCollapsingMergeTree, and insert instead of update.</li><li><strong>Building something that’s fundamentally OLTP — lots of small, frequent, per-row writes and updates?</strong>ClickHouse may be the wrong tool for that specific table; consider whether that data belongs in a transactional database instead, with ClickHouse consuming a change feed from it.</li></ul><h3>10. The Bigger Lesson</h3><p>Every article in this series has pointed at the same underlying idea from a different angle: <strong>ClickHouse’s storage engine is built around immutable, append-only parts, reorganized by background merges.</strong></p><p>UPDATE and DELETE don&#39;t get a special exception to that rule. They&#39;re mutations — bulk part-rewrites — dressed up in familiar SQL syntax. Once you see them that way, a lot of &quot;why is this so slow&quot; and &quot;why did disk usage spike&quot; questions answer themselves.</p><p>The rule of thumb that ties this whole series together:</p><blockquote><strong><em>In ClickHouse, think in inserts, not updates. Let the engine — MergeTree, ReplacingMergeTree, or whatever fits your case — decide what “current” means.</em></strong></blockquote><h3>What’s Next?</h3><p>We’ve now covered how ClickHouse stores data, reads data, and handles changes to that data. The next piece of the puzzle is what happens when a single server isn’t enough.</p><p><strong>Next article:</strong></p><h4>How ClickHouse Scales: Replication and Distributed Tables</h4><p>That’s where we’ll look at how ClickHouse spreads data across multiple servers, how replicas stay in sync without a traditional transaction log, and what a distributed query actually does differently from the single-node queries we’ve been tracing all series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22d854d0824a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How ClickHouse Reads Data: Granules, Marks, Primary Index and Data Skipping]]></title>
            <link>https://medium.com/@beyond_code/how-clickhouse-reads-data-granules-marks-primary-index-and-data-skipping-87712a586710?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/87712a586710</guid>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[clickhousedb]]></category>
            <category><![CDATA[data-optimization]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 14:52:39 GMT</pubDate>
            <atom:updated>2026-09-22T06:42:48.969Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last two articles, we established two ideas. First, ClickHouse is fast because it’s columnar, compressed, sorted, and parallel. Second, data physically lives inside <strong>parts</strong>, made of <strong>granules</strong>, tracked by a <strong>sparse primary index</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1dqCWnlpAIsBxjL5F9tQ9A.png" /><figcaption>Illustration Image</figcaption></figure><p>Now it’s time to answer the question that actually matters day to day:</p><blockquote><strong><em>When you run a query, how does ClickHouse decide what to read — and what to leave alone?</em></strong></blockquote><p>We’re going to take one query, and follow it all the way down: from the SQL statement, through the index, through the marks, to the actual bytes read off disk.</p><h3>1. The Table We’ll Use</h3><p>Same table as before, so nothing new to learn there:</p><pre>CREATE TABLE spend<br>(<br>    event_time DateTime,<br>    customer_id UInt64,<br>    category String,<br>    amount Decimal(18, 2)<br>)<br>ENGINE = MergeTree<br>ORDER BY (customer_id, event_time);</pre><p>And the query we’ll trace through the whole article:</p><pre>SELECT sum(amount)<br>FROM spend<br>WHERE customer_id = 102;</pre><p>Nothing exotic. But a lot happens between typing this and getting a number back.</p><h3>2. Recap: Where the Query Starts</h3><p>Before ClickHouse ever looks at a row, it narrows the search space in stages — partitions first, then parts, then granules within those parts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*XXu80s8k0jm9w2qr2cJLdg.png" /><figcaption>Full path Summary</figcaption></figure><p>Each stage exists to answer one question: <strong>can I prove that this chunk of data is irrelevant?</strong> If yes, skip it entirely. If no, go one level deeper.</p><p>We already covered partitions and parts. The interesting part — literally — is what happens inside a part.</p><h3>3. What the Primary Index Actually Stores</h3><p>The primary index is not a list of rows. It’s a list of <strong>granule boundaries</strong>.</p><p>For every granule in a part, ClickHouse stores the value of the sorting key at the <em>first row</em> of that granule. Since our sorting key is (customer_id, event_time), the index effectively stores &quot;at the start of granule N, customer_id was X.&quot;</p><p>A simplified version of that index might look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OGSTxN5Iv5mGz9-iQWMr5w.png" /><figcaption>t1_index_marks</figcaption></figure><p>Because the data is physically sorted by customer_id, this tiny table is enough to answer &quot;which granules could possibly contain customer_id = 102?&quot; without reading a single row of actual data.</p><h3>4. Granules: The Unit Everything Else Is Built On</h3><p>A granule is a fixed-size batch of rows — by default 8,192 rows (governed by index_granularity). It&#39;s the smallest unit ClickHouse reasons about when deciding what to read.</p><p>This matters because:</p><ul><li>The primary index has one entry per granule, not per row — that’s why it’s “sparse” and stays small even on huge tables.</li><li>Reads happen in whole granules — ClickHouse doesn’t fetch individual rows from disk.</li><li>Data-skipping decisions happen at granule granularity — a granule is either read in full or skipped in full.</li></ul><p>That last point is worth sitting with. ClickHouse doesn’t skip <em>rows</em>. It skips <em>granules</em>. If even one row in a granule could match, the whole granule gets read.</p><h3>5. Marks: The Bridge Between the Index and the Files</h3><p>Knowing “granule 2 might match” doesn’t tell ClickHouse <em>where</em> granule 2’s bytes actually live on disk. That’s the job of <strong>marks</strong>.</p><p>For every column, ClickHouse keeps a .mrk (or .mrk2/.mrk3 depending on settings) file containing the byte offset of each granule inside that column&#39;s compressed data file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lnPU9De1uAuf5ebd-LIhIg.png" /><figcaption>index_marks_bridge</figcaption></figure><p>So the chain is: the primary index tells you <em>which granule numbers</em> are candidates → the marks file tells you <em>the exact byte offset</em> of each of those granule numbers in each column file → ClickHouse seeks straight there.</p><p>No scanning from the beginning of the file. No reading granules in between. Just a direct jump.</p><h3>6. Following the Query, Step by Step</h3><p>Let’s put it all together for our actual query:</p><pre>SELECT sum(amount)<br>FROM spend<br>WHERE customer_id = 102;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*kPImfCHwIa0MvUIHYT83Ug.png" /><figcaption>detailed_query_log</figcaption></figure><ol><li>ClickHouse parses the query and identifies customer_id = 102 as a condition on the sorting key.</li><li>It checks partitions — if event_time were part of the partition key and the query also filtered on it, whole partitions could be dropped here too.</li><li>For each remaining part, it loads that part’s primary index into memory (these are small, so this is cheap).</li><li>It binary-searches the index for customer_id = 102, since the index is sorted.</li><li>That search resolves to one or two candidate granules — not the whole part.</li><li>It looks up those granule numbers in the marks files for customer_id and amount (the only two columns this query needs).</li><li>It seeks directly to those byte offsets and reads just those granules.</li><li>Data is decompressed, filtered down to the exact matching rows, and aggregated using vectorized execution.</li></ol><p>Out of a part with, say, 320,000 rows across 40 granules, this query might touch exactly one granule — 8,192 rows. That’s the entire performance story in one example.</p><h3>7. What “Data Skipping” Actually Looks Like</h3><p>Zooming out from one query, here’s what skipping looks like across a whole part:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_lAi8WzVVrA8Z5AZmrXjQ.png" /><figcaption>Granule_skip</figcaption></figure><p>Only the green ones get touched. Everything else is provably irrelevant based on the index, and ClickHouse never opens those byte ranges at all.</p><p>This is the mental model worth keeping: <strong>ClickHouse’s speed doesn’t come from reading fast. It comes from reading less.</strong></p><h3>8. When the Primary Index Doesn’t Help</h3><p>Here’s the flip side, and it trips people up constantly.</p><pre>SELECT *<br>FROM spend<br>WHERE category = &#39;AWS&#39;;</pre><p>category is not part of ORDER BY (customer_id, event_time). The data is not physically sorted by category anywhere. So the primary index has nothing useful to say about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*KX3ht6PYgiDw02emqccB9Q.png" /><figcaption>Full Scan</figcaption></figure><p>The result: every granule in every part of the relevant partitions has to be read and filtered in memory. The query still runs, and parallelism and vectorization still help — but the biggest lever, data skipping, is gone.</p><p>This is the single most common cause of “why is this ClickHouse query slow” questions.</p><h3>9. Secondary (Data-Skipping) Indexes</h3><p>ORDER BY can only get you so far — it&#39;s one physical sort order per table. For columns outside the sorting key, ClickHouse offers <strong>data-skipping indexes</strong>, which don&#39;t replace the primary index but add extra per-granule metadata that can still prove &quot;this granule can&#39;t match.&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgcHKqHA3OMaw1uPXHkmPA.png" /><figcaption>skip_indexes</figcaption></figure><p>For example:</p><pre>ALTER TABLE spend<br>ADD INDEX idx_category category TYPE set(100) GRANULARITY 4;</pre><p>This doesn’t sort the table by category. It stores, per group of granules, the small set of distinct category values present. If a query filters WHERE category = &#39;AWS&#39; and a given granule group&#39;s recorded set doesn&#39;t contain &#39;AWS&#39;, ClickHouse skips it — without ever reading it.</p><p>These indexes are cheap to store and can meaningfully help queries on non-sorting-key columns, but they’re not a substitute for a well-chosen ORDER BY. Think of them as a second, narrower line of defense.</p><h3>10. Watching It Happen: EXPLAIN and system.query_log</h3><p>You don’t have to take any of this on faith. ClickHouse will show you exactly what it decided to read.</p><pre>EXPLAIN indexes = 1<br>SELECT sum(amount)<br>FROM spend<br>WHERE customer_id = 102;</pre><p>This prints which parts, marks, and granules were selected before the query even runs.</p><p>After running a query, you can also check the real numbers:</p><pre>SELECT<br>    query,<br>    read_rows,<br>    read_bytes,<br>    result_rows<br>FROM system.query_log<br>WHERE query LIKE &#39;%spend%&#39;<br>ORDER BY event_time DESC<br>LIMIT 5;</pre><p>Comparing our two example queries side by side makes the difference concrete:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OI_ZU1QqReWp4nYWA2u6fA.png" /><figcaption>Explain stats</figcaption></figure><p>Same table. Same amount of data on disk. Wildly different amounts of work, purely because of whether the filter aligns with the sorting key.</p><h3>11. Choosing ORDER BY With This in Mind</h3><p>Now that you’ve seen the mechanism, the advice from the earlier articles has a concrete reason behind it:</p><ul><li>Put your most common, most selective filter columns <strong>first</strong> in ORDER BY — that&#39;s what the primary index can binary-search on.</li><li>Columns further down the sorting key still help, but only for queries that also filter on the columns before them.</li><li>Columns not in ORDER BY get no help from the primary index at all — consider a data-skipping index if they&#39;re filtered often.</li><li>A sorting key isn’t just about read performance — it also determines how well compression works, since sorted columns compress better.</li></ul><p>ORDER BY isn&#39;t a formality. It&#39;s the single decision that determines what your primary index can and can&#39;t do for you.</p><h3>12. Putting It All Together</h3><p>The full path, from SQL to bytes, is really just five layers of “can I skip this?”:</p><p><em>(Image: 05_full_path_summary.png — same summary diagram, worth repeating at the end)</em></p><ul><li><strong>Partition</strong> — can I skip based on the partition key?</li><li><strong>Part</strong> — is this part’s data range even relevant?</li><li><strong>Primary index</strong> — which granules can I rule out?</li><li><strong>Marks</strong> — where exactly do the remaining granules live on disk?</li><li><strong>Data-skipping indexes</strong> — can secondary metadata rule out more, for columns outside the sort key?</li></ul><p>Every one of these is a chance to avoid work. ClickHouse doesn’t get fast by processing data quickly — although it does that too, via vectorization and parallelism. It gets fast by minimizing how much data it ever has to touch in the first place.</p><h3>What’s Next?</h3><p>We’ve now covered how ClickHouse stores data and how it reads data. The next natural question is what happens when data isn’t just read, but changed.</p><p><strong>Next article:</strong></p><h4>Updates, Deletes and Mutations in ClickHouse: Why They Work Differently Than You Expect</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87712a586710" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MergeTree Under the Hood: Understanding Parts, Granules, Indexes and Merges]]></title>
            <link>https://medium.com/@beyond_code/mergetree-under-the-hood-understanding-parts-granules-indexes-and-merges-b3d8f4b0a5e8?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3d8f4b0a5e8</guid>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Thu, 17 Sep 2026 15:32:58 GMT</pubDate>
            <atom:updated>2026-09-17T15:32:58.870Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How ClickHouse stores, organizes, indexes, reads, and merges data under the hood.</em></p><p>If you’ve started working with ClickHouse, you’ve probably encountered this:</p><pre>ENGINE = MergeTree</pre><p>It looks like just another table engine definition.</p><p>It isn’t.</p><p><strong>MergeTree is at the heart of ClickHouse.</strong></p><p>Understanding MergeTree changes the way you think about ClickHouse. Instead of seeing a table as simply a collection of rows, you start seeing it as a collection of <strong>parts, granules, indexes, and background processes</strong> working together.</p><p>And once you understand that model, many ClickHouse performance problems suddenly become much easier to explain.</p><p>In this article, we’ll go under the hood and understand what actually happens when data is inserted into a MergeTree table.</p><h3>1. Let’s Start With a Simple Table</h3><p>Consider this table:</p><pre>CREATE TABLE spend<br>(<br>    event_time DateTime,<br>    customer_id UInt64,<br>    category String,<br>    amount Decimal(18, 2)<br>)<br>ENGINE = MergeTree<br>ORDER BY (customer_id, event_time);</pre><p>At first glance, this looks familiar if you’ve worked with relational databases.</p><p>We have:</p><ul><li>Columns</li><li>Data types</li><li>A table</li><li>An ORDER BY</li></ul><p>But internally, ClickHouse doesn’t think about this as one giant table containing rows.</p><p>Instead, data is physically stored in <strong>parts</strong>.</p><p>That’s the first concept we need to understand.</p><h3>2. What Is a Data Part?</h3><p>When you insert data into a MergeTree table, ClickHouse writes that inserted data as a <strong>data part</strong>.</p><p>For example:</p><pre>INSERT INTO spend VALUES<br>(&#39;2026-09-01 10:00:00&#39;, 101, &#39;AWS&#39;, 500),<br>(&#39;2026-09-01 10:01:00&#39;, 102, &#39;GCP&#39;, 300),<br>(&#39;2026-09-01 10:02:00&#39;, 103, &#39;AWS&#39;, 700);</pre><p>This can create a part.</p><p>Another insert:</p><pre>INSERT INTO spend VALUES<br>(&#39;2026-09-01 11:00:00&#39;, 104, &#39;Azure&#39;, 200),<br>(&#39;2026-09-01 11:01:00&#39;, 105, &#39;AWS&#39;, 900);</pre><p>creates another part.</p><p>You can imagine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*rr6w8218dTAyjzZqP1g6OA.png" /><figcaption>Part rows</figcaption></figure><p>As more data arrives, the table can accumulate many parts:</p><p>Part 1 → Part 2 → Part 3 → Part 4 → Part 5 → …</p><p>But ClickHouse doesn’t simply leave them there forever.</p><p>This is where <strong>background merges</strong> enter the picture.</p><h3>3. The MergeTree Name Starts Making Sense</h3><p>Suppose we have four parts sitting on disk.</p><p>ClickHouse can merge them in the background, two at a time, and keep repeating the process until fewer, larger parts remain.</p><p>Conceptually:</p><pre>Part 1 ──┐<br>         ├──&gt; Merged Part A ──┐<br>Part 2 ──┘                    │<br>                              ├──&gt; Larger Part<br>Part 3 ──┐                    │<br>         ├──&gt; Merged Part B ──┘<br>Part 4 ──┘</pre><p>Instead of constantly dealing with hundreds of tiny pieces, ClickHouse gradually creates larger parts.</p><p>This background process is one of the defining characteristics of MergeTree.</p><h3>4. What Does a Part Actually Contain?</h3><p>A part isn’t simply a file containing rows.</p><p>It contains the physical representation of the data for a particular range of rows.</p><p>A part includes things such as:</p><ul><li><strong>Column data</strong><br>customer_id, event_time, category, and amount are stored separately.</li><li><strong>Marks</strong><br>Metadata that helps ClickHouse locate ranges of data inside column files.</li><li><strong>Primary index</strong><br>A sparse index over the sorting key.</li><li><strong>Metadata</strong><br>Checksums, column information, and other bookkeeping data.</li></ul><p>Because ClickHouse is column-oriented, columns are stored separately.</p><p>So for our table, you can think of the part as having separate storage for:</p><pre>customer_id<br>event_time<br>category<br>amount</pre><p>This is one of the reasons ClickHouse can avoid reading columns that a query doesn’t need.</p><h3>5. Where Does ORDER BY Come In?</h3><p>Remember our table:</p><pre>ORDER BY (customer_id, event_time)</pre><p>This is extremely important.</p><p>Within each data part, rows are stored according to the sorting key.</p><p>Conceptually, the data might look like:</p><pre>customer_id   event_time<br>-----------   -------------------<br>101           10:00<br>101           10:05<br>101           10:10<br>102           09:00<br>102           09:10<br>103           12:00</pre><p>This physical organization allows ClickHouse to efficiently identify ranges of data that may be relevant to a query.</p><p>For example:</p><pre>SELECT *<br>FROM spend<br>WHERE customer_id = 102;</pre><p>Because customer_id is the first element of the sorting key, ClickHouse can use the ordering information to skip irrelevant ranges.</p><p>This is where the <strong>primary index</strong> becomes important.</p><h3>6. ClickHouse’s Primary Index Is Different</h3><p>If you’re coming from PostgreSQL or MySQL, the word “index” can create the wrong mental picture.</p><p>You might imagine an index entry for every single row.</p><p>That’s not how the MergeTree primary index works.</p><p>It is a <strong>sparse index</strong>.</p><p>Instead of storing an index entry for every row, ClickHouse stores index information for ranges of data.</p><p>This makes the index much smaller.</p><p>And because the underlying data is sorted, that small amount of index information can still be extremely useful.</p><p>This is one of the key ideas behind ClickHouse’s performance.</p><h3>7. What Are Granules?</h3><p>This brings us to another important concept:</p><p><strong>Granules.</strong></p><p>ClickHouse divides data into groups of rows called granules.</p><p>The primary index contains information about these ranges, so when a query arrives with a condition such as:</p><pre>WHERE customer_id = 102</pre><p>ClickHouse can determine which granules might contain matching values and skip the ones that definitely can’t.</p><p>A useful mental model is:</p><p><strong>Part</strong><br>A physical, on-disk chunk of sorted data created by an insert or merge.</p><p><strong>Granule</strong><br>A small range of rows within a part that the index reasons about.</p><p><strong>Primary index</strong><br>A sparse map from sorting-key values to ranges of data.</p><p><strong>Mark</strong><br>Metadata that lets ClickHouse locate a granule inside the column data.</p><p>Think of it as narrowing down the search area before doing the expensive work.</p><h3>8. The Query Path</h3><p>Let’s put everything together.</p><p>Suppose we execute:</p><pre>SELECT sum(amount)<br>FROM spend<br>WHERE customer_id = 102;</pre><p>Conceptually, ClickHouse goes through a process like this:</p><pre>Query<br>  ↓<br>Find relevant parts<br>  ↓<br>Check primary index<br>  ↓<br>Identify candidate granules<br>  ↓<br>Read required columns<br>  ↓<br>Filter rows<br>  ↓<br>Aggregate<br>  ↓<br>Return result</pre><p>Notice what isn’t necessarily happening:</p><p>ClickHouse isn’t necessarily reading every row in the table.</p><p>That is the magic.</p><p>Well, not magic exactly.</p><p>It’s more like <strong>very disciplined laziness</strong>.</p><blockquote><strong><em>If the engine can prove that data isn’t relevant, it doesn’t read it.</em></strong></blockquote><p>That principle is at the heart of efficient analytical query execution.</p><h3>9. What Happens During an INSERT?</h3><p>Now let’s follow the other side of the system.</p><p>Suppose we execute:</p><pre>INSERT INTO spend VALUES<br>(&#39;2026-09-15 10:00:00&#39;, 101, &#39;AWS&#39;, 500),<br>(&#39;2026-09-15 10:01:00&#39;, 102, &#39;GCP&#39;, 300);</pre><p>Conceptually:</p><pre>INSERT<br>  ↓<br>Data arrives<br>  ↓<br>Rows are sorted according to ORDER BY<br>  ↓<br>Data is written to disk<br>  ↓<br>New data part is created</pre><p>You can then inspect the parts using:</p><pre>SELECT<br>    database,<br>    table,<br>    partition,<br>    name,<br>    rows,<br>    bytes_on_disk,<br>    active<br>FROM system.parts<br>WHERE table = &#39;spend&#39;<br>ORDER BY modification_time DESC;</pre><p>You might see something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qs9GjczfqIhHa0E8v4ZIyg.png" /><figcaption>system.parts</figcaption></figure><pre>system.parts is one of the system tables you&#39;ll become very familiar with when working with ClickHouse in production.</pre><h3>10. What Is a Partition?</h3><p>Now let’s introduce another concept that is often confused with parts.</p><p>Suppose we define:</p><pre>PARTITION BY toYYYYMM(event_time)</pre><p>Our table becomes logically divided into partitions such as:</p><pre>2026-07<br>2026-08<br>2026-09</pre><p>But here’s the important distinction:</p><blockquote><strong><em>A partition can contain multiple parts.</em></strong></blockquote><p>For example, partition 2026-09 might contain:</p><pre>Part 1<br>Part 2<br>Part 3<br>Part 4<br>Part 5</pre><p>all at once.</p><p>So remember:</p><h3>Partition ≠ Part</h3><p>A <strong>partition</strong> is a logical grouping.</p><p>A <strong>part</strong> is a physical data structure stored on disk.</p><p>This distinction becomes extremely important when troubleshooting ClickHouse.</p><h3>11. Why Too Many Parts Can Become a Problem</h3><p>Imagine a table receiving thousands of tiny inserts.</p><p>Instead of having 100 large parts, you might end up with 10,000 tiny ones.</p><p>ClickHouse will attempt to merge them, but that work consumes resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgi5-sV1CCn6ICcpwpwktg.png" /><figcaption>Too Many Parts</figcaption></figure><h3>This is why <strong>insert strategy matters</strong> in ClickHouse.</h3><p>A database can be perfectly healthy at one point and then develop performance problems simply because the ingestion pattern changed.</p><p>For example:</p><pre>Before:<br>Large batched inserts<br>        ↓<br>Fewer parts<br>        ↓<br>Manageable merge workload<br></pre><pre>After:<br>Thousands of tiny inserts<br>        ↓<br>Many small parts<br>        ↓<br>Heavy merge workload<br>        ↓<br>More CPU + I/O</pre><p>The ingestion pattern is part of the performance story.</p><h3>12. Background Merges</h3><p>Let’s look at what ClickHouse is doing in the background.</p><p>You can inspect active merges with:</p><pre>SELECT<br>    database,<br>    table,<br>    elapsed,<br>    progress,<br>    num_parts,<br>    formatReadableSize(total_size_bytes_compressed) AS size<br>FROM system.merges<br>ORDER BY elapsed DESC;</pre><p>You may see something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbfZiY0SbYkzQ3a35gahIA.png" /><figcaption>system_merges</figcaption></figure><p>That tells you ClickHouse is actively merging parts.</p><p>Merges aren’t simply cleanup.</p><p>They are a fundamental part of how MergeTree maintains its physical data layout.</p><h3>13. Merges Are Resource-Intensive</h3><p>Merging data isn’t free.</p><p>Conceptually:</p><pre>Part A ──┐<br>         │<br>Part B ──┼──&gt; Read → Merge/Sort → Write → Part D<br>         │<br>Part C ──┘</pre><p>The process can consume:</p><ul><li>CPU</li><li>Memory</li><li>Disk I/O</li><li>Temporary disk space</li></ul><p>This is why you can sometimes see a ClickHouse server experiencing high CPU even when query traffic hasn’t changed dramatically.</p><p>The database may simply be doing substantial background merge work.</p><p>This is also why monitoring:</p><pre>system.merges<br>system.parts</pre><p>becomes valuable during production incidents.</p><h3>14. What Happens to the Old Parts?</h3><p>After a successful merge, the new part replaces the old parts in the active data set.</p><p>The old parts aren’t necessarily deleted instantly.</p><p>ClickHouse has lifecycle and cleanup mechanisms for old data parts.</p><p>From a logical perspective, however, queries begin using the new merged part.</p><p>So conceptually:</p><pre>Before merge:</pre><pre>Part A<br>Part B<br>Part C<br></pre><pre>After merge:</pre><pre>        ↓</pre><pre>Part D</pre><p>The physical storage has been reorganized, while the logical table continues to represent the same dataset.</p><h3>15. Why This Architecture Works So Well</h3><p>Now we can see the larger picture.</p><p>ClickHouse combines:</p><ul><li>Columnar storage</li><li>Sorted data</li><li>A sparse primary index</li><li>Granules</li><li>Data skipping</li><li>Background merges</li><li>Parallel execution</li></ul><p>into one storage and execution model.</p><p>The result is a system optimized for large analytical workloads.</p><p>The important point is that these aren’t isolated features.</p><p>They work together.</p><p>The way ClickHouse <strong>writes</strong> data directly influences the way it can <strong>read</strong> data efficiently.</p><h3>16. The Mental Model I Wish I Had When I Started</h3><p>If you’re new to ClickHouse, this is the picture to keep in your head.</p><h3>Write path</h3><pre>INSERT<br>  ↓<br>New parts<br>  ↓<br>Background merges<br>  ↓<br>Larger parts</pre><h3>Read path</h3><pre>QUERY<br>  ↓<br>Partition pruning<br>  ↓<br>Primary index<br>  ↓<br>Granule skipping<br>  ↓<br>Read required columns<br>  ↓<br>Process data<br>  ↓<br>Result</pre><p>The two paths are connected.</p><p>The write path creates the physical organization that the read path later exploits.</p><p>Once this picture becomes clear, many ClickHouse concepts stop feeling like isolated features.</p><p>They become pieces of the same machine.</p><h3>17. The Production Connection</h3><p>This isn’t just theory.</p><p>When you’re investigating a ClickHouse production issue, these concepts become practical tools.</p><h3>Query suddenly became slow</h3><p>Start by looking at:</p><pre>system.query_log</pre><h3>Too many parts</h3><p>Look at:</p><pre>system.parts</pre><h3>CPU suddenly increased</h3><p>Check:</p><pre>system.merges</pre><p>along with query activity.</p><h3>Data isn’t being skipped effectively</h3><p>Investigate:</p><pre>ORDER BY<br>Primary Key<br>EXPLAIN</pre><h3>Disk usage suddenly increased</h3><p>Look at:</p><pre>system.parts<br>system.merges<br>mutations</pre><p>The more you understand the storage engine, the easier it becomes to connect symptoms to causes.</p><h3>18. The Most Important Takeaway</h3><p>When I first started looking at ClickHouse, it was tempting to think of MergeTree simply as a line in a CREATE TABLEstatement.</p><p>But that’s only the surface.</p><p>Underneath it is a constantly evolving storage structure.</p><p>Inserts create new parts.</p><p>Parts are sorted and indexed.</p><p>Background merges continuously reorganize storage into fewer, larger parts.</p><p>Queries skip everything they can prove is irrelevant.</p><p>Remember these four ideas:</p><blockquote><strong><em>Data arrives as parts.</em></strong></blockquote><blockquote><strong><em>Parts are sorted and indexed.</em></strong></blockquote><blockquote><strong><em>Queries skip what they don’t need.</em></strong></blockquote><blockquote><strong><em>Background merges continuously reorganize the storage.</em></strong></blockquote><p>Once you understand that, you’re no longer just using ClickHouse.</p><p>You’re starting to understand how ClickHouse thinks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XGvmbO-OINr9Lq_yq1edDg.png" /><figcaption>concepts</figcaption></figure><h3>What’s Next?</h3><p>Now that we’ve opened the hood, the next question is:</p><blockquote><strong><em>How does ClickHouse actually find the data it needs without scanning everything?</em></strong></blockquote><p>That’s where granules, marks, the sparse primary index, and data skipping become really interesting.</p><h3>Next article</h3><p><strong>How ClickHouse Reads Data: Granules, Marks, Primary Index and Data Skipping</strong></p><p>In the next article, we’ll take a real query and follow it from the SQL statement all the way down to the data ClickHouse actually reads.</p><h3>Final Thought</h3><p>ClickHouse performance isn’t built from one magical optimization.</p><p>It comes from a chain of decisions:</p><pre>How data is inserted<br>        ↓<br>How parts are created<br>        ↓<br>How data is sorted<br>        ↓<br>How indexes represent the data<br>        ↓<br>How granules are skipped<br>        ↓<br>How columns are read<br>        ↓<br>How parts are merged<br>        ↓<br>How queries are executed</pre><p>Once you understand that chain, ClickHouse becomes much less mysterious.</p><p>And that’s exactly where the fun begins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3d8f4b0a5e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Is ClickHouse So Fast? Understanding What Happens Under the Hood]]></title>
            <link>https://medium.com/@beyond_code/why-is-clickhouse-so-fast-understanding-what-happens-under-the-hood-5c51da5d41ae?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c51da5d41ae</guid>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[fastest]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 10:45:35 GMT</pubDate>
            <atom:updated>2026-09-15T10:45:35.446Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever run a query on ClickHouse and wondered how it can scan millions or even billions of rows so quickly, the answer isn’t simply “because ClickHouse is optimized.”</p><p>There are several design decisions working together behind the scenes.</p><p>ClickHouse is built specifically for <strong>analytical workloads</strong>, and almost every part of its architecture is designed around one fundamental idea:</p><blockquote><strong><em>Read less data, process it efficiently, and use the hardware as much as possible.</em></strong></blockquote><p>In this article, we’ll break down the major reasons behind ClickHouse’s performance and understand what happens when a query runs.</p><h3>1. ClickHouse Is a Column-Oriented Database</h3><p>This is probably the first concept to understand.</p><p>Traditional relational databases such as PostgreSQL and MySQL are commonly used for transactional workloads. Data is generally thought of in terms of rows.</p><p>Imagine a table:</p><p>user_idevent_timeevent_typeamount1012026–09–01purchase5001022026–09–01login01032026–09–01purchase750</p><p>Suppose we run:</p><pre>SELECT sum(amount)<br>FROM events;</pre><p>We only need the amount column.</p><p>ClickHouse stores data by columns, so it can read the amount column without reading user_id, event_time, or event_type.</p><p>Conceptually:</p><pre>Row-oriented storage</pre><pre>Row 1 → user_id + event_time + event_type + amount<br>Row 2 → user_id + event_time + event_type + amount<br>Row 3 → user_id + event_time + event_type + amount<br></pre><pre>Column-oriented storage</pre><pre>user_id     → 101, 102, 103...<br>event_time  → ...<br>event_type  → ...<br>amount      → 500, 0, 750...</pre><p>For analytical queries that typically operate on a subset of columns across a large number of rows, this can dramatically reduce I/O.</p><h3>2. ClickHouse Reads Only the Columns It Needs</h3><p>Consider this query:</p><pre>SELECT<br>    customer_id,<br>    sum(amount)<br>FROM spend<br>GROUP BY customer_id;</pre><p>ClickHouse doesn’t need every column in the table.</p><p>It primarily needs:</p><pre>customer_id<br>amount</pre><p>The fewer columns that need to be read, the less data needs to come from disk and be decompressed.</p><p>This is also why avoiding unnecessary SELECT * can matter in analytical workloads.</p><p>Instead of:</p><pre>SELECT *<br>FROM spend<br>WHERE customer_id = 100;</pre><p>prefer:</p><pre>SELECT<br>    event_date,<br>    customer_id,<br>    amount<br>FROM spend<br>WHERE customer_id = 100;</pre><p>when those are the only fields you actually need.</p><h3>3. Compression Makes a Huge Difference</h3><p>Columnar storage also works extremely well with compression.</p><p>Why?</p><p>Because values in the same column tend to have similar characteristics.</p><p>For example:</p><pre>customer_id:</pre><pre>100<br>100<br>100<br>101<br>101<br>101<br>102<br>102<br>102</pre><p>Compared with a mixture of completely different values across rows, this kind of data is much easier to compress.</p><p>ClickHouse supports multiple compression codecs and encoding techniques.</p><p>The important point is:</p><pre>Less data on disk<br>       ↓<br>Less data read<br>       ↓<br>Less I/O<br>       ↓<br>Faster queries</pre><p>Compression isn’t just about saving disk space. It can also improve query performance because there is less data to read from storage.</p><h3>4. ORDER BY Is Extremely Important</h3><p>One of the most important ClickHouse concepts is the table’s sorting key.</p><p>For example:</p><pre>CREATE TABLE spend<br>(<br>    customer_id UInt64,<br>    event_date Date,<br>    amount Decimal(18, 2)<br>)<br>ENGINE = MergeTree<br>ORDER BY (customer_id, event_date);</pre><p>The ORDER BY clause determines how data is physically organized inside ClickHouse parts.</p><p>This matters because ClickHouse doesn’t need to blindly scan every row to answer every query.</p><p>Suppose we query:</p><pre>SELECT sum(amount)<br>FROM spend<br>WHERE customer_id = 100;</pre><p>Because customer_id is part of the sorting key, ClickHouse can use its index information to identify which ranges of data are relevant.</p><p>That leads us to one of the most important pieces of ClickHouse’s performance story.</p><h3>5. Sparse Primary Indexes and Data Skipping</h3><p>ClickHouse doesn’t generally maintain a traditional B-tree index for every row.</p><p>Instead, MergeTree tables use a <strong>sparse primary index</strong>.</p><p>The data is organized into relatively small ranges called <strong>granules</strong>.</p><p>The primary index stores information that helps ClickHouse determine which granules might contain the requested data.</p><p>Conceptually:</p><pre>Table<br> │<br> ├── Part 1<br> │    ├── Granule 1<br> │    ├── Granule 2<br> │    ├── Granule 3<br> │    └── ...<br> │<br> ├── Part 2<br> │    ├── Granule 1<br> │    ├── Granule 2<br> │    └── ...<br> │<br> └── Part 3</pre><p>If the query contains a condition that matches the sorting key, ClickHouse can often eliminate large portions of the data before actually reading them.</p><p>So instead of:</p><pre>Read everything<br>      ↓<br>Filter rows</pre><p>it can do something closer to:</p><pre>Use index<br>   ↓<br>Identify relevant ranges<br>   ↓<br>Read those ranges<br>   ↓<br>Process the data</pre><p>This is one of the key reasons a well-designed ClickHouse table can be extremely fast.</p><h3>6. Granules: ClickHouse Doesn’t Index Every Row</h3><p>A common misconception is:</p><blockquote><em>“ClickHouse has an index on every row.”</em></blockquote><p>That’s not how the MergeTree primary index works.</p><p>The index is sparse.</p><p>Data is divided into granules, and the index contains information that allows ClickHouse to skip granules that cannot satisfy the query.</p><p>This design keeps the index relatively small while still allowing significant data skipping.</p><p>That gives us another important principle:</p><blockquote><strong><em>ClickHouse doesn’t necessarily make your query fast by finding the exact row. It makes your query fast by avoiding huge amounts of irrelevant data.</em></strong></blockquote><h3>7. PARTITION BY Can Help Eliminate Entire Partitions</h3><p>ClickHouse also supports partitioning.</p><p>For example:</p><pre>CREATE TABLE events<br>(<br>    event_time DateTime,<br>    customer_id UInt64,<br>    amount Decimal(18, 2)<br>)<br>ENGINE = MergeTree<br>PARTITION BY toYYYYMM(event_time)<br>ORDER BY (customer_id, event_time);</pre><p>Now data may be organized approximately like:</p><pre>2026-01<br>2026-02<br>2026-03<br>2026-04<br>...</pre><p>If we query:</p><pre>SELECT sum(amount)<br>FROM events<br>WHERE event_time &gt;= &#39;2026-04-01&#39;<br>  AND event_time &lt; &#39;2026-05-01&#39;;</pre><p>ClickHouse can potentially eliminate partitions that are outside the requested range.</p><p>This is called <strong>partition pruning</strong>.</p><p>But partitioning isn’t something we should add everywhere.</p><p>Too many partitions can create operational and performance problems.</p><p>A good ClickHouse schema is about choosing the right physical data layout for the workload.</p><h3>8. ClickHouse Processes Data in Parallel</h3><p>Modern servers have many CPU cores.</p><p>ClickHouse is designed to take advantage of them.</p><p>A query can be processed through multiple execution threads.</p><p>Conceptually:</p><pre>Query<br>                    │<br>          ┌─────────┼─────────┐<br>          ↓         ↓         ↓<br>       Thread 1  Thread 2  Thread 3<br>          ↓         ↓         ↓<br>       Process    Process    Process<br>        data       data       data<br>          └─────────┼─────────┘<br>                    ↓<br>                 Result</pre><p>This is particularly useful for analytical queries because operations such as scanning, filtering, and aggregation can be parallelized.</p><p>Instead of one CPU core doing all the work, ClickHouse can use multiple cores simultaneously.</p><h3>9. Vectorized Query Execution</h3><p>Another important optimization is <strong>vectorized execution</strong>.</p><p>Instead of processing data strictly one row at a time:</p><pre>Row → process<br>Row → process<br>Row → process<br>Row → process</pre><p>ClickHouse processes batches of values.</p><p>Conceptually:</p><pre>Column batch<br>[10, 20, 30, 40, 50, ...]<br>          ↓<br>     Vectorized operation<br>          ↓<br>[20, 40, 60, 80, 100, ...]</pre><p>Modern CPUs are very good at performing operations over batches of data.</p><p>This allows ClickHouse to make efficient use of CPU resources for large analytical operations.</p><h3>10. Aggregations Are a First-Class Workload</h3><p>Consider:</p><pre>SELECT<br>    customer_id,<br>    sum(amount),<br>    count()<br>FROM spend<br>GROUP BY customer_id;</pre><p>This is exactly the kind of workload ClickHouse is designed for.</p><p>ClickHouse can:</p><pre>Read required columns<br>        ↓<br>Filter data<br>        ↓<br>Process batches in parallel<br>        ↓<br>Build aggregation states<br>        ↓<br>Combine results<br>        ↓<br>Return final result</pre><p>The engine is heavily optimized for operations such as:</p><ul><li>GROUP BY</li><li>SUM</li><li>COUNT</li><li>AVG</li><li>uniq</li><li>Quantiles</li><li>Sorting</li><li>Filtering</li></ul><p>This is very different from the workload typically associated with an OLTP database.</p><h3>11. MergeTree Works in the Background</h3><p>There is another important piece of the puzzle: <strong>data parts and background merges</strong>.</p><p>When data is inserted into a MergeTree table, ClickHouse creates data parts.</p><p>For example:</p><pre>INSERT<br>  ↓<br>Part A</pre><pre>INSERT<br>  ↓<br>Part B</pre><pre>INSERT<br>  ↓<br>Part C</pre><p>ClickHouse then performs background merges:</p><pre>Part A ─┐<br>        ├──→ Larger Part<br>Part B ─┤<br>        │<br>Part C ─┘</pre><p>These merges help maintain the storage layout and reduce the number of small parts over time.</p><p>This is one reason ClickHouse performance isn’t just about what happens when you run a SELECT.</p><p>The way you <strong>insert data</strong> also matters.</p><h3>12. Efficient Hardware Utilization</h3><p>ClickHouse is designed to make good use of modern hardware:</p><pre>CPU<br> │<br> ├── Parallel execution<br> ├── Vectorized operations<br> └── Efficient aggregation</pre><pre>Memory<br> │<br> ├── Caching<br> ├── Query processing<br> └── Aggregation</pre><pre>Disk<br> │<br> ├── Columnar storage<br> ├── Compression<br> └── Sequential/efficient reads</pre><p>When the table design and workload are appropriate, ClickHouse can keep multiple parts of the hardware busy at the same time.</p><h3>13. But ClickHouse Isn’t Automatically Fast</h3><p>This is probably the most important lesson.</p><p>Installing ClickHouse doesn’t automatically make every query fast.</p><p>You can still write expensive queries.</p><p>For example:</p><pre>SELECT *<br>FROM huge_table;</pre><p>If your table contains billions of rows and hundreds of columns, ClickHouse still has to do a lot of work.</p><p>Similarly, a poor sorting key can prevent effective data skipping.</p><p>Too many small inserts can create excessive parts.</p><p>Large aggregations can consume significant memory.</p><p>Expensive joins can become bottlenecks.</p><p>So the better way to think about ClickHouse is:</p><blockquote><strong><em>ClickHouse gives you the architecture to process analytical workloads extremely efficiently. Your schema, queries, and workload determine how much of that potential you actually get.</em></strong></blockquote><h3>Putting It All Together</h3><p>When you execute a query such as:</p><pre>SELECT<br>    customer_id,<br>    sum(amount)<br>FROM spend<br>WHERE customer_id = 100<br>GROUP BY customer_id;</pre><p>a simplified view looks like this:</p><pre>SQL Query<br>                       │<br>                       ↓<br>              Query Analysis<br>                       │<br>                       ↓<br>              Identify Columns<br>              customer_id<br>                  amount<br>                       │<br>                       ↓<br>             Partition Pruning<br>                       │<br>                       ↓<br>             Primary Index<br>                       │<br>                       ↓<br>              Skip Granules<br>                       │<br>                       ↓<br>             Read Required Data<br>                       │<br>                       ↓<br>                Decompress<br>                       │<br>                       ↓<br>           Vectorized Processing<br>                       │<br>                       ↓<br>             Parallel Aggregation<br>                       │<br>                       ↓<br>                  Result</pre><p>And that is the real ClickHouse performance story.</p><p>It isn’t one magic feature.</p><p>It’s the combination of:</p><p><strong>Columnar storage + compression + physical sorting + sparse indexes + data skipping + partition pruning + vectorized execution + parallel processing + efficient aggregation + background merges.</strong></p><p>All of these pieces work together.</p><h3>The Bigger Lesson</h3><p>Coming from a traditional relational database background, one of the biggest mindset shifts when learning ClickHouse is this:</p><blockquote><strong><em>Don’t ask only, “How do I make this query faster?”</em></strong></blockquote><p>Instead, start asking:</p><blockquote><strong><em>“How can I make ClickHouse avoid reading and processing unnecessary data in the first place?”</em></strong></blockquote><p>That question leads naturally to:</p><ul><li>How should I choose my ORDER BY?</li><li>Do I actually need PARTITION BY?</li><li>How many columns am I reading?</li><li>How many rows are being scanned?</li><li>How many bytes are being read?</li><li>Can ClickHouse skip data?</li><li>Are my inserts creating too many parts?</li><li>Are background merges keeping up?</li><li>Is the query CPU-bound, memory-bound, or I/O-bound?</li></ul><p>Once you start thinking this way, ClickHouse performance becomes much less mysterious.</p><p>And that’s where the interesting part begins.</p><p><strong>Next:</strong> <em>ClickHouse MergeTree Under the Hood: Parts, Granules, Marks and Background Merges</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c51da5d41ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Tale of Two Data Centers, Part Two: Locking Down ClickHouse and Keeper with SSL/TLS]]></title>
            <link>https://medium.com/@beyond_code/a-tale-of-two-data-centers-part-two-locking-down-clickhouse-and-keeper-with-ssl-tls-73039ea1883e?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/73039ea1883e</guid>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[clickhouse]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 10:09:17 GMT</pubDate>
            <atom:updated>2026-09-02T10:09:17.556Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The cluster is alive. Now the certificates show up — carrying their own suitcase full of problems.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJjI--hqCZKjx1muQl3a1g.png" /></figure><p>Priya and Arjun’s three-node ch_cluster has been running for a few weeks now. Ingest is steady, Keeper hasn&#39;t complained since that one stale-coordination incident, and the analytics team is happy.</p><p>Then security review happens. Both of them get the same finding:</p><p><em>“Inter-node ClickHouse and Keeper traffic is unencrypted. Remediate before the next audit cycle.”</em></p><p>Fair enough. Plaintext replication traffic between DBA-CH-PILOT-POC1, POC2, and POC3 was fine for a proof of concept. It is not fine for anything security will sign off on. So both engineers open the same next ticket: turn on SSL/TLS, everywhere — client connections, inter-server replication, and the Keeper quorum itself.</p><p>If the curl story was about <em>getting software onto a box</em>, this one is about something more sensitive: <em>getting a private key onto a box without anyone intercepting it along the way.</em> That distinction changes everything about how Priya and Arjun approach the problem.</p><h3>The Certificate Problem Nobody Warns You About</h3><p>Before any XML gets edited, there’s a decision to make: where does trust come from?</p><p>For a three-node cluster, the practical answer is usually a private certificate authority — one CA key, one CA certificate, and one signed certificate per node, all sharing the SAN (Subject Alternative Name) list of every node in the cluster:</p><pre># san.cnf<br>[req]<br>default_bits       = 4096<br>prompt             = no<br>distinguished_name = req_distinguished_name<br>req_extensions     = req_ext</pre><pre>[req_distinguished_name]<br>countryName         = IN<br>stateOrProvinceName = Telangana<br>localityName        = Hyderabad<br>organizationName    = Test Platforms Ltd<br>commonName          = DBA-CH-PILOT</pre><pre>[req_ext]<br>subjectAltName = @alt_names</pre><pre>[alt_names]<br>IP.1 = 10.0.0.1<br>IP.2 = 10.0.0.2<br>IP.3 = 10.0.0.3<br>DNS.1 = localhost</pre><p>That file is identical for Priya and Arjun. The moment they generate the CA key, though, the two stories split again — for exactly the same reason they split during installation.</p><h3>Road One: Priya Generates and Distributes with the Network Wide Open</h3><p>Priya does everything on one designated “master” node and pushes outward.</p><pre>openssl genpkey -algorithm RSA -out ca.key<br>openssl req -x509 -new -nodes -key ca.key -days 3650 -out ca.crt</pre><pre>openssl genpkey -algorithm RSA -out node.10.0.0.1.key<br>openssl req -new -key node.10.0.0.1.key -out node.10.0.0.1.csr -config san.cnf<br>openssl x509 -req -in node.10.0.0.1.csr -CA ca.crt -CAkey ca.key \<br>  -CAcreateserial -out node.10.0.0.1.crt -days 3650 \<br>  -extfile san.cnf -extensions req_ext</pre><p>Same pattern for 10.0.0.2 and 10.0.0.3. Because her environment allows normal SSH and SCP between hosts, distributing the CA cert plus each node&#39;s key/cert pair is a non-event:</p><pre>scp ca.crt node.10.0.0.2.crt node.10.0.0.2.key DBA-CH-PILOT-POC2:/etc/clickhouse-server/certs/<br>scp ca.crt node.10.0.0.3.crt node.10.0.0.3.key DBA-CH-PILOT-POC3:/etc/clickhouse-server/certs/</pre><p>She locks down permissions on every node the moment the files land:</p><pre>chown clickhouse:clickhouse -R /etc/clickhouse-server/certs<br>chmod 600 /etc/clickhouse-server/certs/*<br>chmod 755 /etc/clickhouse-server/certs</pre><p>For Priya, the certificate story is short: generate on the master, scp outward, lock down permissions, move on to configuration. The interesting part of <em>her</em> week is the same as everyone&#39;s — Keeper.</p><h3>Road Two: Arjun Discovers That Private Keys Don’t Travel Like Public Packages</h3><p>Arjun already knows the drill from the install: production has no direct path in or out. But this time it’s worse, because what’s crossing the boundary now isn’t a .deb file — it&#39;s a <strong>private key</strong>. A leaked .deb is an inconvenience. A leaked private key is an incident.</p><p>So the process that felt like overkill for package installation now feels appropriately serious.</p><p><strong>Step 1 — Generate everything on an approved, isolated signing host</strong>, never on a laptop, never on a shared jump box:</p><pre>mkdir -p /etc/clickhouse-server/certs<br>openssl genpkey -algorithm RSA -out ca.key<br>openssl req -x509 -new -nodes -key ca.key -days 3650 -out ca.crt</pre><p><strong>Step 2 — Issue node certificates against the same CA</strong>, one per node, exactly like Priya, but every artifact now gets treated as sensitive material rather than a build output:</p><pre>openssl genpkey -algorithm RSA -out node.10.0.0.1.key<br>openssl req -new -key node.10.0.0.1.key -out node.10.0.0.1.csr -config san.cnf<br>openssl x509 -req -in node.10.0.0.1.csr -CA ca.crt -CAkey ca.key \<br>  -CAcreateserial -out node.10.0.0.1.crt -days 3650 \<br>  -extfile san.cnf -extensions req_ext</pre><p><strong>Step 3 — Move the key material across the boundary through an approved secrets-transfer path</strong>, not through the same general-purpose artifact mirror used for .deb packages. Depending on the organization, that might mean a hardware-backed transfer process, an approved secrets vault, or a sanctioned SCP/WinSCP path with its own audit trail — separate from whatever channel was used to move installation packages. Arjun treats the two as different processes even though both technically involve &quot;getting a file from A to B,&quot; because a compromised install package and a compromised private key have very different blast radii.</p><p><strong>Step 4 — Verify what actually arrived, twice.</strong> Once for the certificate’s validity window:</p><pre>openssl x509 -in /etc/clickhouse-server/certs/node.10.0.0.1.crt -noout -dates</pre><p>And once to confirm the key and certificate actually belong together — a mismatch here fails silently at connection time in a way that’s miserable to debug later:</p><pre>openssl x509 -noout -modulus -in node.10.0.0.1.crt | openssl md5<br>openssl rsa  -noout -modulus -in node.10.0.0.1.key | openssl md5</pre><p>If those two hashes don’t match, stop right there — nothing downstream will work, and the failure mode won’t clearly point back to “wrong key.”</p><p><strong>Step 5 — Lock down ownership immediately on arrival</strong>, same as Priya, no exceptions:</p><pre>chown clickhouse:clickhouse -R /etc/clickhouse-server/certs<br>chmod 600 /etc/clickhouse-server/certs/*<br>chmod 755 /etc/clickhouse-server/certs</pre><p>For Arjun, the certificate chapter takes longer — not because OpenSSL is hard, but because moving key material through an approved, auditable path is its own small project. Same as the install chapter, the logistics are the critical path, not the cryptography.</p><h3>Where the Two Roads Meet Again</h3><p>Once certificates exist on every node — however they got there — Priya and Arjun make the exact same configuration changes.</p><p><strong>Keeper starts listening on a secure port</strong>, and gets its own Raft-secure port too:</p><pre>&lt;!-- enable-keeper.xml --&gt;<br>&lt;clickhouse&gt;<br>    &lt;keeper_server&gt;<br>        &lt;tcp_port_secure&gt;9281&lt;/tcp_port_secure&gt;<br>        &lt;raft_port_secure&gt;9444&lt;/raft_port_secure&gt;<br>        &lt;server_id&gt;1&lt;/server_id&gt;<br>        &lt;log_storage_path&gt;/var/lib/clickhouse/coordination/log&lt;/log_storage_path&gt;<br>        &lt;snapshot_storage_path&gt;/var/lib/clickhouse/coordination/snapshots&lt;/snapshot_storage_path&gt;<br>        &lt;coordination_settings&gt;<br>            &lt;operation_timeout_ms&gt;10000&lt;/operation_timeout_ms&gt;<br>            &lt;session_timeout_ms&gt;30000&lt;/session_timeout_ms&gt;<br>            &lt;raft_logs_level&gt;trace&lt;/raft_logs_level&gt;<br>        &lt;/coordination_settings&gt;<br>        &lt;raft_configuration&gt;<br>            &lt;server&gt;&lt;id&gt;1&lt;/id&gt;&lt;hostname&gt;DBA-CH-PILOT-POC1&lt;/hostname&gt;&lt;port&gt;9444&lt;/port&gt;&lt;/server&gt;<br>            &lt;server&gt;&lt;id&gt;2&lt;/id&gt;&lt;hostname&gt;DBA-CH-PILOT-POC2&lt;/hostname&gt;&lt;port&gt;9444&lt;/port&gt;&lt;/server&gt;<br>            &lt;server&gt;&lt;id&gt;3&lt;/id&gt;&lt;hostname&gt;DBA-CH-PILOT-POC3&lt;/hostname&gt;&lt;port&gt;9444&lt;/port&gt;&lt;/server&gt;<br>        &lt;/raft_configuration&gt;<br>    &lt;/keeper_server&gt;<br>&lt;/clickhouse&gt;</pre><p><strong>Every node’s ZooKeeper/Keeper client block gets the </strong><strong>secure flag flipped on</strong>:</p><pre>&lt;!-- use-keeper.xml --&gt;<br>&lt;clickhouse&gt;<br>   &lt;zookeeper&gt;<br>       &lt;node&gt;&lt;host&gt;DBA-CH-PILOT-POC1&lt;/host&gt;&lt;port&gt;9281&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/node&gt;<br>       &lt;node&gt;&lt;host&gt;DBA-CH-PILOT-POC2&lt;/host&gt;&lt;port&gt;9281&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/node&gt;<br>       &lt;node&gt;&lt;host&gt;DBA-CH-PILOT-POC3&lt;/host&gt;&lt;port&gt;9281&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/node&gt;<br>   &lt;/zookeeper&gt;<br>&lt;/clickhouse&gt;</pre><p><strong>The cluster definition moves to the secure native port</strong>:</p><pre>&lt;!-- remote-servers.xml --&gt;<br>&lt;clickhouse&gt;<br>    &lt;remote_servers replace=&quot;true&quot;&gt;<br>        &lt;ch_cluster&gt;<br>            &lt;secret&gt;clickhouse_poc&lt;/secret&gt;<br>            &lt;shard&gt;&lt;internal_replication&gt;true&lt;/internal_replication&gt;<br>                &lt;replica&gt;&lt;host&gt;DBA-CH-PILOT-POC1&lt;/host&gt;&lt;port&gt;9440&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/replica&gt;<br>            &lt;/shard&gt;<br>            &lt;shard&gt;&lt;internal_replication&gt;true&lt;/internal_replication&gt;<br>                &lt;replica&gt;&lt;host&gt;DBA-CH-PILOT-POC2&lt;/host&gt;&lt;port&gt;9440&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/replica&gt;<br>            &lt;/shard&gt;<br>            &lt;shard&gt;&lt;internal_replication&gt;true&lt;/internal_replication&gt;<br>                &lt;replica&gt;&lt;host&gt;DBA-CH-PILOT-POC3&lt;/host&gt;&lt;port&gt;9440&lt;/port&gt;&lt;secure&gt;1&lt;/secure&gt;&lt;/replica&gt;<br>            &lt;/shard&gt;<br>        &lt;/ch_cluster&gt;<br>    &lt;/remote_servers&gt;<br>&lt;/clickhouse&gt;</pre><p><strong>Networking switches to the HTTPS and secure-native ports</strong>, with the old plaintext ports commented out once everything is confirmed working:</p><pre>&lt;!-- network-and-logging.xml --&gt;<br>&lt;clickhouse&gt;<br>    &lt;logger&gt;<br>        &lt;level&gt;debug&lt;/level&gt;<br>        &lt;log&gt;/var/log/clickhouse-server/clickhouse-server.log&lt;/log&gt;<br>        &lt;errorlog&gt;/var/log/clickhouse-server/clickhouse-server.err.log&lt;/errorlog&gt;<br>        &lt;size&gt;1000M&lt;/size&gt;<br>        &lt;count&gt;3&lt;/count&gt;<br>    &lt;/logger&gt;<br>    &lt;display_name&gt;clickhouse&lt;/display_name&gt;<br>    &lt;listen_host&gt;0.0.0.0&lt;/listen_host&gt;<br>    &lt;https_port&gt;8443&lt;/https_port&gt;<br>    &lt;tcp_port_secure&gt;9440&lt;/tcp_port_secure&gt;<br>    &lt;interserver_https_port&gt;9010&lt;/interserver_https_port&gt;<br>&lt;/clickhouse&gt;</pre><p><strong>OpenSSL gets pointed at the certificate paths</strong>, on both the server and client side:</p><pre>&lt;!-- openssl.xml --&gt;<br>&lt;clickhouse&gt;<br>    &lt;openSSL&gt;<br>        &lt;server&gt;<br>            &lt;certificateFile&gt;/etc/clickhouse-server/certs/server1.crt&lt;/certificateFile&gt;<br>            &lt;privateKeyFile&gt;/etc/clickhouse-server/certs/server1.key&lt;/privateKeyFile&gt;<br>            &lt;verificationMode&gt;relaxed&lt;/verificationMode&gt;<br>            &lt;caConfig&gt;/etc/clickhouse-server/certs/ca.crt&lt;/caConfig&gt;<br>            &lt;cacheSessions&gt;true&lt;/cacheSessions&gt;<br>            &lt;disableProtocols&gt;sslv2,sslv3&lt;/disableProtocols&gt;<br>            &lt;preferServerCiphers&gt;true&lt;/preferServerCiphers&gt;<br>        &lt;/server&gt;<br>        &lt;client&gt;<br>            &lt;loadDefaultCAFile&gt;false&lt;/loadDefaultCAFile&gt;<br>            &lt;caConfig&gt;/etc/clickhouse-server/certs/ca.crt&lt;/caConfig&gt;<br>            &lt;cacheSessions&gt;true&lt;/cacheSessions&gt;<br>            &lt;disableProtocols&gt;sslv2,sslv3&lt;/disableProtocols&gt;<br>            &lt;verificationMode&gt;relaxed&lt;/verificationMode&gt;<br>            &lt;invalidCertificateHandler&gt;&lt;name&gt;RejectCertificateHandler&lt;/name&gt;&lt;/invalidCertificateHandler&gt;<br>        &lt;/client&gt;<br>    &lt;/openSSL&gt;<br>&lt;/clickhouse&gt;</pre><p><strong>And, if gRPC is in use, it gets the same treatment</strong>:</p><pre>&lt;!-- grpc.xml --&gt;<br>&lt;clickhouse&gt;<br>    &lt;grpc&gt;<br>        &lt;enable_ssl&gt;true&lt;/enable_ssl&gt;<br>        &lt;ssl_cert_file&gt;/etc/clickhouse-server/certs/server1.crt&lt;/ssl_cert_file&gt;<br>        &lt;ssl_key_file&gt;/etc/clickhouse-server/certs/server1.key&lt;/ssl_key_file&gt;<br>        &lt;ssl_require_client_auth&gt;true&lt;/ssl_require_client_auth&gt;<br>        &lt;ssl_ca_cert_file&gt;/etc/clickhouse-server/certs/ca.crt&lt;/ssl_ca_cert_file&gt;<br>    &lt;/grpc&gt;<br>&lt;/clickhouse&gt;</pre><p>Both engineers restart node by node — never all at once, same discipline as the original Keeper rollout — and validate:</p><pre>clickhouse-client --user default --password --port 9440 --secure --host DBA-CH-PILOT-POC1</pre><pre>SHOW CLUSTERS;<br>SELECT * FROM system.clusters;<br>CREATE DATABASE test ON CLUSTER ch_cluster;</pre><pre>netstat -tulnp | grep clickhouse</pre><p>Once each node shows 9440, 8443, 9281, and 9444 listening — and the plaintext ports are gone from the list — the encryption layer is live.</p><h3>What Actually Bit Each of Them, This Time</h3><p>Priya’s node briefly refused to talk to itself on the plaintext port after cutover:</p><pre>telnet 10.0.0.1 9000<br>telnet: connect to address 10.0.0.1: Connection refused</pre><p>That wasn’t a bug. It was the point — &lt;tcp_port&gt;9000&lt;/tcp_port&gt; had been commented out on purpose once 9440 took over. The fix wasn&#39;t a fix; it was updating every client and monitoring integration that still pointed at the old port.</p><p>Arjun’s problem was quieter and nastier: a Keeper node that wouldn’t rejoin the quorum after a routine restart, throwing a handshake rejection that looked identical to the plaintext coordination error from months earlier. This time the cause wasn’t stale coordination data — it was a certificate that had been reissued during the migration without updating every node’s copy of the CA bundle. One node was still trusting the <em>old</em> CA. Keeper doesn’t fail loudly when trust breaks; it just quietly refuses the handshake. The lesson he wrote down for next time: <strong>when you rotate a CA, treat every node’s trust store as out of date until you’ve personally confirmed otherwise</strong> — don’t assume a “successful” file copy means the right file landed everywhere.</p><h3>Two Environments, One Set of Certificates</h3><p>PriyaArjunCA and key generationOn a master node, same networkOn an isolated signing hostNode cert distributionDirect scpApproved secrets-transfer path, separate from package transferVerificationStandard checksumChecksum plus expiry and modulus match, recorded for the change ticketBiggest riskConvenience creating bad habitsLogistics slowing down a routine cert rotationFinal cluster configurationIdenticalIdentical</p><p>Same as the install story: the destination doesn’t change. Keeper still wants a secure port and a Raft quorum that trusts the same CA. ClickHouse still wants a certificate and key that match. The only thing that changes with network restrictions is how carefully — and through what path — the key material gets there.</p><h3>The Real Lesson of This Chapter</h3><p>Installing software across a security boundary is a logistics problem. Moving private keys across that same boundary is a logistics problem <em>with consequences if you get it wrong</em>. Same shape, higher stakes.</p><p>If there’s one habit worth carrying out of this chapter, it’s this: don’t let certificate rotation become a routine scp command that nobody thinks twice about. Verify the modulus match. Confirm every node&#39;s CA bundle after any change. And treat &quot;the file copied successfully&quot; and &quot;the right file is trusted everywhere it needs to be&quot; as two separate facts — because Keeper will let you find out the difference at the worst possible time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73039ea1883e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Tale of Two Data Centers: Installing ClickHouse On-Prem, With Curl and Without It]]></title>
            <link>https://medium.com/@beyond_code/a-tale-of-two-data-centers-installing-clickhouse-on-prem-with-curl-and-without-it-7d37e55e8a1b?source=rss-600c0ed9ba10------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d37e55e8a1b</guid>
            <category><![CDATA[on-premise-vs-saas]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[clickhouse-installation]]></category>
            <dc:creator><![CDATA[Beyond the code]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 07:08:33 GMT</pubDate>
            <atom:updated>2026-08-25T07:08:33.862Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A field story about standing up the same three-node ClickHouse + Keeper cluster in two very different environments.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjuKnfN2a8HcHGg5dvFg9A.png" /></figure><p>Two engineers. Two data centers. One Friday afternoon ticket:</p><blockquote><strong><em>“Stand up a 3-node ClickHouse cluster with Keeper coordination for the analytics team.”</em></strong></blockquote><p>For Priya, the task looks straightforward.</p><p>She is working in a modern cloud-adjacent environment where outbound HTTPS is allowed. curl works. Package repositories are reachable. Installing ClickHouse is mostly a matter of following the documentation.</p><p>Arjun has a very different Friday.</p><p>He is inside a bank’s on-premises environment, where production servers have no direct internet access. A command as innocent as:</p><pre>ping 8.8.8.8</pre><p>is enough to make the security team curious.</p><p>Same goal.</p><p>Same three nodes:</p><pre>DBA-CH-PILOT-POC1<br>DBA-CH-PILOT-POC2<br>DBA-CH-PILOT-POC3</pre><p>Same ports.</p><p>Same ClickHouse version.</p><p>Same three-node Keeper quorum.</p><p>Completely different installation journeys.</p><p>And that difference is something you discover very quickly when you move from a lab environment to real enterprise infrastructure.</p><h3>The Groundwork Nobody Gets to Skip</h3><p>Before either engineer installs a single ClickHouse package, there is a checklist.</p><p>First, hostname resolution.</p><p>On every node, they make sure the three servers can resolve each other reliably, either through enterprise DNS or, where appropriate, /etc/hosts:</p><pre>DBA-CH-PILOT-POC1<br>DBA-CH-PILOT-POC2<br>DBA-CH-PILOT-POC3</pre><p>Then comes networking.</p><p>Depending on the architecture, the required ClickHouse and Keeper traffic must be permitted between the nodes. Typical ports include:</p><pre>9000   Native ClickHouse protocol<br>8123   HTTP interface<br>9009   Inter-server communication<br>9181   Keeper client connections<br>9440   Secure native protocol<br>9234   Keeper/Raft communication</pre><p>The exact port requirements depend on the configuration, but the important word here is <strong>connectivity</strong>.</p><p>A beautifully configured three-node cluster is still three lonely servers if they cannot talk to each other.</p><p>Then comes time synchronization.</p><p>Keeper uses Raft-based coordination, so clock discipline matters. Both engineers verify chrony or the organization&#39;s approved NTP setup.</p><p>Finally:</p><ul><li>Root or sudo access</li><li>Correct service account</li><li>Correct filesystem permissions</li><li>Sufficient disk space</li><li>Firewall rules</li><li>Security approvals</li></ul><p>Only after this groundwork does the interesting part begin.</p><p><strong>How do you actually get ClickHouse onto the servers?</strong></p><h3>Road One: Priya, Where Curl Just Works</h3><p>Priya’s environment allows outbound HTTPS.</p><p>She can use the ClickHouse package repository directly.</p><p>For a Debian/Ubuntu-based system, the installation might look like:</p><pre>sudo apt-get install -y apt-transport-https ca-certificates curl gnupg</pre><p>Then configure the repository and install the required packages:</p><pre>sudo apt-get update</pre><pre>sudo apt-get install -y \<br>    clickhouse-server \<br>    clickhouse-client \<br>    clickhouse-common-static \<br>    clickhouse-keeper</pre><p>In a real deployment, Priya also pins the ClickHouse version so that all three nodes are running the same tested build.</p><p>For example:</p><pre>25.3.2.39</pre><p>The important thing isn’t the exact version.</p><p>The important thing is <strong>version consistency</strong>.</p><p>You don’t want:</p><pre>POC1 → ClickHouse 25.x<br>POC2 → ClickHouse 24.x<br>POC3 → ClickHouse 25.x</pre><p>and then spend Monday morning investigating behavior that is actually caused by version differences.</p><p>For Priya, the installation phase is relatively painless.</p><p>Repository reachable.</p><p>Packages available.</p><p>Dependencies available.</p><p>Installation complete.</p><p>She can move on to the part that actually requires distributed-systems thinking.</p><p>Keeper.</p><h3>Road Two: Arjun, Where the Firewall Says “Absolutely Not”</h3><p>Arjun tries the same approach.</p><p>It doesn’t go well.</p><p>The repository request times out.</p><p>The proxy denies the connection.</p><p>The GPG key cannot be fetched.</p><p>apt-get update cannot reach the external repository.</p><p>And that’s when the important realization arrives:</p><p><strong>This isn’t a ClickHouse problem.</strong></p><p>It’s a software supply-chain problem.</p><p>The production server is intentionally isolated from the internet.</p><p>So Arjun changes the installation strategy.</p><h3>Step 1: Download the packages somewhere approved</h3><p>Instead of downloading directly on the production nodes, the packages are obtained through an approved workstation, jump host, or internal artifact repository.</p><p>For example:</p><pre>curl -fsSLO https://packages.clickhouse.com/deb/pool/stable/clickhouse-server_25.3.2.39_amd64.deb<br>curl -fsSLO https://packages.clickhouse.com/deb/pool/stable/clickhouse-client_25.3.2.39_amd64.deb<br>curl -fsSLO https://packages.clickhouse.com/deb/pool/stable/clickhouse-common-static_25.3.2.39_amd64.deb<br>curl -fsSLO https://packages.clickhouse.com/deb/pool/stable/clickhouse-keeper_25.3.2.39_amd64.deb</pre><p>The exact download process should follow the organization’s approved software-supply-chain procedure.</p><p>Because this is a production environment, downloading a package is only half the job.</p><p>You also need to establish:</p><p><strong>“Is this actually the artifact we intended to install?”</strong></p><h3>Step 2: Verify the artifacts</h3><p>Arjun calculates checksums:</p><pre>sha256sum clickhouse-*.deb &gt; checksums.txt</pre><p>The checksums are recorded as part of the change or deployment process.</p><p>In a stricter environment, the organization may also require package signature verification or verification against an internally trusted artifact repository.</p><p>This is where the process starts looking less like:</p><blockquote><em>“Install ClickHouse.”</em></blockquote><p>and more like:</p><blockquote><em>“Move a controlled software artifact through a security boundary.”</em></blockquote><p>That distinction matters.</p><h3>Step 3: Move the Packages Across the Boundary</h3><p>This is where Arjun discovers that the hardest part of installing a database isn’t necessarily the database.</p><p>The organization might use:</p><ul><li>Internal Artifactory or Nexus</li><li>An approved SFTP transfer</li><li>A hardened jump host</li><li>A controlled software distribution system</li><li>Another security-approved transfer mechanism</li></ul><p>Whatever mechanism is used, the production server should receive software through a <strong>controlled and auditable path</strong>.</p><p>And this is often where the calendar starts fighting back.</p><p>The ClickHouse installation might take ten minutes.</p><p>The artifact approval might take two days.</p><h3>Step 4: Install Without Internet Access</h3><p>Once the .deb packages are available on the production server, Arjun can install them locally:</p><pre>sudo dpkg -i clickhouse-common-static_25.3.2.39_amd64.deb<br>sudo dpkg -i clickhouse-server_25.3.2.39_amd64.deb<br>sudo dpkg -i clickhouse-client_25.3.2.39_amd64.deb<br>sudo dpkg -i clickhouse-keeper_25.3.2.39_amd64.deb</pre><p>Dependency handling needs to be planned for an offline environment too.</p><p>A command such as:</p><pre>sudo apt-get install -f</pre><p>only helps if the required dependencies are already available through configured local repositories or another approved offline source.</p><p>That is one of the traps of offline installation.</p><p><strong>“The ClickHouse packages are here” does not automatically mean “everything ClickHouse needs is here.”</strong></p><p>So Arjun verifies what was actually installed:</p><pre>dpkg -l | grep clickhouse</pre><p>No external repository is required at installation time.</p><p>No live internet connection is required.</p><p>The packages arrived through the organization’s controlled path.</p><p>And now something interesting happens.</p><h3>The Two Roads Converge</h3><p>Once the software is installed, Priya and Arjun are effectively standing in the same place.</p><p>The network restrictions changed <strong>how the binaries arrived</strong>.</p><p>They did not change how ClickHouse clustering works.</p><p>Both engineers now need to configure:</p><h3>Server networking</h3><p>Listen addresses, ClickHouse ports, logging, and other server-level settings.</p><h3>Node identity</h3><p>Each node needs a unique identity within the cluster.</p><p>For example:</p><pre>POC1 → replica 1<br>POC2 → replica 2<br>POC3 → replica 3</pre><p>depending on the chosen topology.</p><h3>Keeper</h3><p>Each node needs the appropriate Keeper configuration and a unique server_id in the Keeper ensemble.</p><h3>Cluster topology</h3><p>The ClickHouse cluster configuration needs to describe the nodes and their roles correctly.</p><h3>File ownership</h3><p>Configuration and data directories must have the correct ownership and permissions.</p><h3>Service management</h3><p>The systemd services need to be enabled and started appropriately.</p><p>For example:</p><pre>sudo systemctl enable clickhouse-server clickhouse-keeper<br>sudo systemctl start clickhouse-server clickhouse-keeper</pre><p>The exact service name can vary with package/configuration details, so it is worth verifying what was installed rather than blindly copying a service name from another environment.</p><h3>Configuration: Keep Your Changes Modular</h3><p>One practice I strongly prefer is keeping custom configuration in ClickHouse’s configuration fragments rather than editing the shipped configuration files directly.</p><p>For example:</p><pre>/etc/clickhouse-server/config.d/</pre><p>You might have separate fragments for:</p><pre>network-and-logging.xml<br>macros.xml<br>use-keeper.xml<br>enable-keeper.xml<br>remote-servers.xml</pre><p>The idea is simple:</p><p><strong>Keep vendor configuration separate from your environment-specific configuration.</strong></p><p>It makes troubleshooting, upgrades, reviews, and rollback much easier.</p><h3>Don’t Restart Three Nodes at Once</h3><p>This is another lesson that sounds obvious only after you’ve been burned by distributed systems.</p><p>When working with a Keeper quorum, don’t casually restart everything simultaneously.</p><p>Instead:</p><ol><li>Configure the nodes.</li><li>Start or restart one node.</li><li>Verify Keeper health.</li><li>Confirm the node participates correctly in the quorum.</li><li>Move to the next node.</li><li>Repeat.</li></ol><p>You’re not trying to win a race against systemctl.</p><p>You’re trying to preserve a functioning quorum.</p><h3>Validation Time</h3><p>Once all three nodes are up, don’t declare victory because:</p><pre>systemctl status clickhouse-server</pre><p>says:</p><pre>active (running)</pre><p>A process being alive isn’t the same thing as a cluster being healthy.</p><p>Check the ClickHouse cluster configuration:</p><pre>SELECT *<br>FROM system.clusters;</pre><p>Check Keeper connectivity and cluster health using the appropriate system tables and Keeper diagnostics for your ClickHouse version.</p><p>Then perform a controlled distributed operation, such as:</p><pre>CREATE DATABASE test_db<br>ON CLUSTER ch_cluster;</pre><p>If the operation succeeds across the intended nodes, you’re starting to test the <strong>cluster</strong>, not merely the individual servers.</p><p>You can also verify that the expected ports are listening:</p><pre>ss -lntp | grep clickhouse</pre><p>And test connectivity between nodes where appropriate.</p><h3>And Then the Cluster Decides to Have Opinions</h3><p>This is where the story gets interesting.</p><p>Priya’s installation was smooth.</p><p>Packages installed.</p><p>Services started.</p><p>Configuration loaded.</p><p>And then Keeper complained.</p><p>Something along the lines of:</p><pre>Code: 999. Coordination::Exception:<br>Keeper server rejected the connection during the handshake.<br>Possibly it&#39;s overloaded, doesn&#39;t see leader or stale...</pre><p>The important lesson here is that <strong>the installation method wasn’t the problem</strong>.</p><p>The problem was coordination state from an earlier test environment.</p><p>In a disposable lab or controlled test environment, one possible recovery approach can be to stop the services and clear the local Keeper coordination state:</p><pre>sudo systemctl stop clickhouse-keeper clickhouse-server</pre><pre>sudo rm -rf /var/lib/clickhouse/coordination/log/*<br>sudo rm -rf /var/lib/clickhouse/coordination/snapshots/*</pre><pre>sudo systemctl start clickhouse-keeper clickhouse-server</pre><p>But this deserves a giant warning sign:</p><blockquote><em>⚠️ </em><strong><em>Do not treat this as a routine production troubleshooting command.</em></strong></blockquote><p>Keeper logs and snapshots contain coordination state. Deleting them can have serious consequences, especially in a multi-node or production Keeper deployment.</p><p>Before doing anything destructive, establish the topology, understand where the authoritative state lives, confirm backups/recovery options, and follow your organization’s ClickHouse/Keeper recovery procedure.</p><p>In a disposable POC, the answer can be very different from the answer in production.</p><p>That distinction is critical.</p><h3>Meanwhile, Arjun’s Database Wasn’t Even Installed Yet</h3><p>Arjun’s problem was completely different.</p><p>His ClickHouse configuration was ready.</p><p>His server was ready.</p><p>His disks were ready.</p><p>His firewall rules were ready.</p><p>But the package mirror request was still waiting for approval.</p><p>Two days.</p><p>Not because ClickHouse was complicated.</p><p>Because infrastructure has dependencies.</p><p>That became his biggest lesson:</p><p><strong>In restricted environments, software acquisition can become the critical path.</strong></p><p>So next time, Arjun isn’t going to wait until the firewall ticket is approved before requesting the artifact mirror.</p><p>He’s going to run both processes in parallel.</p><p>Because sometimes the fastest way to deploy a database is to start the paperwork before you start the installation.</p><h3>What I Learned From the Two Roads</h3><p>If you’re planning a ClickHouse rollout on real on-prem infrastructure, don’t begin the runbook with:</p><pre>curl ...</pre><p>Begin with a question:</p><blockquote><strong><em>“Can these servers access the internet?”</em></strong></blockquote><p>If the answer is yes, great.</p><p>Your installation path may be relatively straightforward.</p><p>If the answer is no, ask a second question:</p><blockquote><strong><em>“How does this organization approve and distribute software into restricted environments?”</em></strong></blockquote><p>That answer will determine your installation process.</p><h3>Two Environments, One Destination</h3><p>PriyaArjunInternet accessAvailableBlockedPackage sourceExternal repositoryApproved artifact pathcurlWorksNot from productionapt-get updatePossibleExternal access unavailablePackage transferDirectControlled transferChecksum/signature processStandardMore formalBiggest challengeCluster configurationSoftware logisticsFinal ClickHouse architectureSameSame</p><p>And that’s the part I found most interesting.</p><p>The architecture didn’t change.</p><p>Keeper didn’t change.</p><p>Raft didn’t change.</p><p>ClickHouse didn’t change.</p><p>Only the <strong>road to get there</strong> changed.</p><h3>The Real On-Prem Lesson</h3><p>When you move from a development laptop to enterprise infrastructure, the database is only one piece of the puzzle.</p><p>You are also dealing with:</p><p><strong>Networking.</strong></p><p><strong>Security.</strong></p><p><strong>Software supply chains.</strong></p><p><strong>Change management.</strong></p><p><strong>Artifact repositories.</strong></p><p><strong>Certificates.</strong></p><p><strong>Firewall approvals.</strong></p><p><strong>Monitoring.</strong></p><p><strong>Disaster recovery.</strong></p><p>And sometimes, an innocuous-looking curl command becomes a three-day conversation with the security team.</p><p>That’s on-prem.</p><p>The command may be:</p><pre>curl ...</pre><p>But the deployment is never just a command.</p><p>It’s a system.</p><p>And understanding that difference is what turns a ClickHouse installation from <em>“it works on my VM”</em> into something you can actually run in an enterprise environment.</p><p><em>Next chapter: SSL/TLS between ClickHouse nodes and Keeper. Because once the cluster is alive, the certificates arrive carrying their own suitcase full of problems.</em> 🔐</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d37e55e8a1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>