← Questions
Design tables and metrics for product event data
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Meta's system design round, last asked Sep 2025. It tests data modeling, data engineering and metrics.
Design a dimensional model for a transactional analytics use case, such as an online store's orders or a product's in-app purchases. Define the metrics that matter for it, then design the fact and dimension tables that compute them, and show how the model handles change over time and new requirements.
Requirements
- Functional: a core fact table with its grain, keys and measures stated, and four or five dimension tables around it.
- Functional: track changes to dimension attributes over time (for example a customer's region or a product's category) with Slowly Changing Dimension type 2.
- Functional: show one-to-many and many-to-many relationships between tables, and how the cardinality shapes the schema.
- Functional: handle one many-to-many relationship (for example an order with several promotions) with a bridge table or a second fact table.
- Functional: plan schema changes for new requirements: a new column, a new dimension, normalizing a table, a new fact.
- Non-functional: high-volume transaction data loaded every day. Queries over months of data must stay fast, and there should be one authoritative fact table where possible.
Clarifying questions
- Which business questions must the model answer first, and at what latency?
- What is the source: an OLTP database, an event stream, or both? How late can records arrive?
- Which attributes change, and does reporting need the value at the time of the transaction or the current one?
- What volume per day, and how much history do we keep?
What a strong answer covers
- The grain stated first (for example one row per order line), then the keys (surrogate keys to each dimension, the degenerate order id) and additive measures (quantity, amount, discount).
- Dimensions such as date, customer, product, store or channel, and promotion, with their key attributes.
- SCD type 2 mechanics: a surrogate key per version,
valid_from,valid_to,is_current, and how the daily load closes the old row and opens a new one. Facts join to the version that was valid at transaction time. - A bridge table with weighting factors for many-to-many, compared with a separate fact at the finer grain, including the double-counting risk.
- Metrics defined against the model (revenue, orders per customer, conversion) and the summary tables or aggregates that serve them.
- Partitioning the fact by date, incremental loads, late-arriving facts and dimensions, and the cost of each schema change.
Follow-ups
- A dimension attribute changes thousands of times a day. Is SCD type 2 still right?
- Add a returns process. A new fact, or new rows in the existing fact?
- Two teams define "active customer" differently. Where does the definition live?
Where it's asked
- Meta · System design · Last asked Sep 202545 min · Design discussion; either an LLM-agent system or a classic product system · Nominally AI-enabled, but the assistant is often not used
What it tests
data modeling · data engineering · metrics
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
