DataLane
← All stacks

ClickHouse

MergeTree, ORDER BY, and why tiny inserts die

5 questions with solutions

  1. Q1CloudflareUbereBay

    What is the primary index in ClickHouse?

    Solution

    ORDER BY (the sorting key). There is no B-tree on every column. A wrong ORDER BY is a full scan. Say that before you talk about clusters.

  2. Q2CloudflareContentsquareLyft

    Why are inserts batched?

    Solution

    Each insert makes parts. Too many parts and merges cannot keep up. Batch in the client or a buffer table. One-row inserts are how the cluster dies.

  3. Q3DatadogGitLabNotion

    ClickHouse or Snowflake for product analytics?

    Solution

    ClickHouse when ingest + scan latency is the product. Snowflake when governance, sharing, and SQL analysts are the product. Many companies run both.

  4. Q4YandexUberByteDance

    Can I UPDATE a fact like Postgres?

    Solution

    Mutations are expensive background rewrites. Design append-only or use ReplacingMergeTree with a version. Frequent point updates belong in OLTP.

  5. Q5StripeShopifySquare

    Is ClickHouse a source of truth?

    Solution

    No. Keep Postgres (or similar) for transactions. ClickHouse is the analytic replica. Treating it as OLTP is the wrong interview answer.

↑↓ navigate openesc close