<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ClickHouse MergeTree Internals on Random Tech Excursions</title><link>https://ssushant.me/clickhouse/</link><description>Recent content in ClickHouse MergeTree Internals on Random Tech Excursions</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="https://ssushant.me/clickhouse/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://ssushant.me/clickhouse/chapter-1/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-1/</guid><description>&lt;h1 id="chapter-1-data-part-and-metadata" class="relative group"&gt;Chapter 1: Data Part and Metadata &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-1-data-part-and-metadata" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome! If you are new to ClickHouse and MergeTree, you have come to the right place. This chapter is a friendly, no-fear introduction to two core ideas: &lt;strong&gt;data parts&lt;/strong&gt; and &lt;strong&gt;metadata&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Imagine a paper notebook. The whole notebook is your MergeTree table. Each chapter is a &lt;strong&gt;data part&lt;/strong&gt;. Each chapter knows which pages it covers, and &lt;strong&gt;marks&lt;/strong&gt; are little bookmarks that help you jump to the right page. This chapter is about those chapters and the table of contents that keeps track of them.&lt;/p&gt;</description></item><item><title/><link>https://ssushant.me/clickhouse/chapter-2/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-2/</guid><description>&lt;h1 id="chapter-2-write-path-and-part-creation" class="relative group"&gt;Chapter 2: Write Path and Part Creation &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-2-write-path-and-part-creation" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome back! In &#10; &#10; &lt;a href="https://ssushant.me/clickhouse/chapter-1/"&gt;Chapter 1: Data Part and Metadata&lt;/a&gt;, we met the main character of MergeTree: the &lt;strong&gt;data part&lt;/strong&gt;. A data part is a self-contained directory with column files, marks, indexes, and checksums.&lt;/p&gt;&#10;&lt;p&gt;Now it’s time to answer a natural question: &lt;strong&gt;How does a data part get created?&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;This chapter walks through the &lt;strong&gt;Write Path&lt;/strong&gt;: the journey every inserted row takes from &lt;code&gt;INSERT&lt;/code&gt; to a visible, queryable data part.&lt;/p&gt;</description></item><item><title/><link>https://ssushant.me/clickhouse/chapter-3/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-3/</guid><description>&lt;h1 id="chapter-3-read-path-and-query-execution" class="relative group"&gt;Chapter 3: Read Path and Query Execution &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-3-read-path-and-query-execution" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome back! In &#10; &#10; &lt;a href="https://ssushant.me/clickhouse/chapter-2/"&gt;Chapter 2: Write Path and Part Creation&lt;/a&gt;, we followed inserted rows as they became new data parts. Now let’s turn the page and look at the other side of the story: &lt;strong&gt;how does ClickHouse read data back out?&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;The answer is the &lt;strong&gt;Read Path&lt;/strong&gt;. This is the machinery that turns a &lt;code&gt;SELECT&lt;/code&gt; query into a set of small, parallel read jobs.&lt;/p&gt;</description></item><item><title/><link>https://ssushant.me/clickhouse/chapter-4/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-4/</guid><description>&lt;h1 id="chapter-4-indexes-and-conditions" class="relative group"&gt;Chapter 4: Indexes and Conditions &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-4-indexes-and-conditions" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome back! In &#10; &#10; &lt;a href="https://ssushant.me/clickhouse/chapter-3/"&gt;Chapter 3: Read Path and Query Execution&lt;/a&gt;, you followed a &lt;code&gt;SELECT&lt;/code&gt; query as it created tasks and read mark ranges. But one mystery remained: &lt;strong&gt;how does ClickHouse decide which mark ranges to read in the first place?&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;The answer is &lt;strong&gt;Indexes and Conditions&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Imagine a reference book with two helpful features. First, a table of contents tells you which chapter to open. Second, pages have highlighted sentences, so you can quickly skip entire pages if they don&amp;rsquo;t contain what you need.&lt;/p&gt;</description></item><item><title/><link>https://ssushant.me/clickhouse/chapter-5/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-5/</guid><description>&lt;h1 id="chapter-5-background-merges-mutations-and-compaction-selection" class="relative group"&gt;Chapter 5: Background Merges, Mutations, and Compaction Selection &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-5-background-merges-mutations-and-compaction-selection" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome back! In &#10; &#10; &lt;a href="https://ssushant.me/clickhouse/chapter-4/"&gt;Chapter 4: Indexes and Conditions&lt;/a&gt;, you saw how &lt;code&gt;SELECT&lt;/code&gt; queries use indexes to skip data. But data does not stay still. New inserts keep arriving, old rows need corrections, and too many tiny data parts can make reads slow.&lt;/p&gt;&#10;&lt;p&gt;This chapter is about &lt;strong&gt;housekeeping&lt;/strong&gt;. MergeTree has background jobs that tidy up the table. They merge small parts into bigger parts and apply mutations. There is also a &lt;strong&gt;selection policy&lt;/strong&gt; that decides which parts should be merged first.&lt;/p&gt;</description></item><item><title/><link>https://ssushant.me/clickhouse/chapter-6/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ssushant.me/clickhouse/chapter-6/</guid><description>&lt;h1 id="chapter-6-replication-and-zookeeper-coordination" class="relative group"&gt;Chapter 6: Replication and ZooKeeper Coordination &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#chapter-6-replication-and-zookeeper-coordination" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;Welcome back! In &#10; &#10; &lt;a href="https://ssushant.me/clickhouse/chapter-5/"&gt;Chapter 5: Background Merges, Mutations, and Compaction Selection&lt;/a&gt;, you saw how a single MergeTree table tidies itself up with merges and mutations. But what if the table lives on &lt;strong&gt;several machines&lt;/strong&gt;? What if one machine is offline? How do all the machines agree on which data parts exist?&lt;/p&gt;&#10;&lt;p&gt;That is the job of &lt;strong&gt;Replication and ZooKeeper Coordination&lt;/strong&gt;.&lt;/p&gt;</description></item></channel></rss>