Design a Query Engine for Interactive Funnels Over Raw Events

Last updated: November 29, 2026

Quick Overview

Design the storage layout and query execution for answering ad-hoc funnel, retention and breakdown queries over trillions of raw events per year in a few seconds, without pre-aggregating by known dimensions.

Mixpanel
System Design
Software Engineer
Mixpanel
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design the storage layout and query execution for answering ad-hoc funnel, retention and breakdown queries over trillions of raw events per year in a few seconds, without pre-aggregating by known dimensions.

Mixpanel's pitch is answering arbitrary questions on raw event data quickly, and it has written publicly about computing funnels faster than a warehouse. The interviewer wants a reasoned columnar layout, a per-user scan model that fits sequence queries, and a fan-out plan with caching.

What the Interviewer Expects
  • Explain why sequence queries need per-user ordered data, not just column scans
  • Columnar files partitioned by project and time, sorted by user then time
  • Scatter-gather with per-shard partial aggregates that merge cleanly
  • Predicate pushdown, dictionary encoding and column pruning
  • Caching and sampling strategy for interactivity
  • Tail latency control across hundreds of shards
Key Topics to Cover
columnar storage
scatter-gather
partial aggregation
sort order
caching
tail latency
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • A breakdown by a high-cardinality property (URL) returns millions of groups: how do you bound it?
  • How do you handle a query over two years for the largest customer within a 10 second budget?
  • How would results stay correct when identity merges change who a user is?
  • Where would you put a results cache and how do you invalidate it as new events land?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Queries: trends with filters and breakdowns, ordered funnels with windows, retention, unique counts. Arbitrary event properties (schemaless JSON from customers). Latency p50 about 1 second, p99 under ...

High-Level Design

Data lives in shards keyed by hash(project, user). Within a shard, each day (or hour) is a columnar file sorted by (distinct_id, time), stored in object storage with a local SSD cache. A **query p...


Submit Your Answer
Markdown supported

Related Questions