Build a columnar OLAP store (ClickHouse / Druid style)

About Build a columnar OLAP store (ClickHouse / Druid style)

OLTP picks one row by key; OLAP scans a billion rows of one column and asks for a percentile. Build the analytical engine that makes that fast: columnar layout, dictionary/RLE/delta compression, vectorized execution, late materialization, MPP shuffle. Internalize why Postgres is 1000× slower than ClickHouse on the same query and why the inverse is also true.

Difficulty
advanced
Time
about 95 minutes
Stages
9
Topic
Storage Engines & Databases

How this problem is worked

Nine stages, from what the thing is for to how it compares with the real implementations. Each asks one question, and the simulator runs the architecture you draw against the requirements you wrote.

  1. 01Purpose & invariantsWhat is this for, and what must always be true of it?
  2. 02Workload characterizationWho writes, who reads, and in what shapes?
  3. 03Data model & on-disk formatWhat does the data look like at rest?
  4. 04Core algorithmsHow do the write path and the read path actually work?
  5. 05Distribution & replicationHow does this scale out and survive losing a machine?
  6. 06Consistency & correctnessUnder concurrency and failure, what is guaranteed?
  7. 07Failure modes & recoveryWhat actually happens when each part fails?
  8. 08Operational characteristicsCan a human run this at three in the morning?
  9. 09Trade-offs & comparisonWhere does this sit against the alternatives?

Primary sources for this problem

  • Stonebraker et al. — C-Store: A Column-oriented DBMS (VLDB 2005)
  • Abadi et al. — Column-Stores vs. Row-Stores: How Different Are They Really? (SIGMOD 2008)
  • ClickHouse documentation — Architecture, MergeTree, query pipeline
  • Apache Druid — Design paper (Druid: A Real-time Analytical Data Store, SIGMOD 2014)
  • Snowflake — The Snowflake Elastic Data Warehouse (SIGMOD 2016)
  • Boncz et al. — MonetDB/X100: Hyper-Pipelining Query Execution (CIDR 2005)
  • Apache Arrow — In-memory columnar format spec

More in Storage Engines & Databases

Open the box every design diagram labels "DB": pages, logs, LSM trees, wide-column, documents, graphs and columnar scans, built from scratch.

Browse the full problem catalog, or see what the simulator does and does not model.