Skip to content
Reliable Data Engineering
Lesson
Open in the interactive app

The Data Modeling Process

In a modeling interview, nobody cares if you memorised “star schema”. They care whether you can turn a vague business ask into tables with a clear grain that answer the questions correctly and efficiently, and evolve without breaking.


1. Three levels of models

flowchart LR
    C["Conceptual<br/>entities + relationships<br/>(business language)"] --> L["Logical<br/>attributes, keys, cardinality,<br/>normal form / dimensional design"]
    L --> P["Physical<br/>tables, types, partitions,<br/>clustering, constraints, engine"]
LevelAudienceExample
ConceptualBusiness stakeholders”A rider requests a trip; a driver fulfils it; the trip has a payment.”
LogicalEngineers, analystsfact_trip(trip_id, rider_key, driver_key, date_key, fare_amount, …), dim_rider(rider_key, …)
PhysicalEngineersDelta table clustered by (trip_date, city_id), fare_amount DECIMAL(12,2), SCD2 columns

2. OLTP vs OLAP modeling

OLTP (application DB)OLAP (warehouse / lakehouse)
GoalFast, correct writes; integrityFast, understandable reads over history
ShapeNormalised (3NF): no redundancyDenormalised: star schemas, wide tables
QueriesPoint lookups, small transactionsScans + aggregations over millions/billions of rows
HistoryCurrent state (overwrite)Full history (append, SCD)
UsersApplicationsAnalysts, BI, ML

Normalisation in one table

FormRuleViolation example
1NFAtomic values, no repeating groupsphone_numbers = "123, 456"
2NFNo partial dependency on part of a composite keyorder_line(order_id, product_id, product_name): name depends only on product_id
3NFNo transitive dependencycustomer(id, zip, city): city depends on zip

Why OLAP denormalises: joins across 15 normalised tables are slow and error-prone for analysts. A star schema trades storage redundancy (cheap) for query simplicity and speed. Why not one giant table for everything: updates to a dimension attribute would require rewriting billions of fact rows, and different facts have different grains.


3. Kimball’s four-step design process (use it in interviews)

flowchart TD
    A["1 · Select the business process<br/>(e.g. trips, orders, ad impressions)"] --> B["2 · Declare the grain<br/>one row = one trip / one order line / one impression"]
    B --> C["3 · Identify the dimensions<br/>who, what, where, when, how"]
    C --> D["4 · Identify the facts<br/>numeric measures true at that grain"]

Step 2 is the one that matters: the grain

Grain = the exact meaning of one row. Declare it in one sentence before listing columns.

Facts must be true at the grain

Grain: one row per order lineValid factsInvalid facts
quantity, line_amount, discount_on_lineorder_shipping_fee (order-level), customer_lifetime_value (customer-level)

Order-level facts go in an order-grain fact table (or are allocated to lines with an explicit rule).


4. The modeling interview script

  1. Clarify the business: what decisions will this data support? List 4–6 concrete questions (“revenue by city by week”, “average driver rating”, “cancellation rate by hour”).
  2. Identify business processes (each typically becomes a fact table): trips, payments, ratings, driver shifts.
  3. Declare the grain of each fact table.
  4. Dimensions shared across facts (conformed): date, rider, driver, city, product.
  5. Draw the ERD (star per process, shared dims in the middle).
  6. Handle change: which dimension attributes need history (SCD2)? Late-arriving data?
  7. Validate against the questions: write 2–3 of the business questions as SQL against your model. If a query is awkward, the model is wrong.
  8. Physical design: partitioning/clustering, surrogate keys, incremental loading, data quality checks.
  9. Trade-offs: star vs OBT for BI, SCD2 vs snapshots, where to compute metrics.

Bus matrix: the one-slide summary of a model

Business process (fact)DateCustomerProductStorePromotionEmployee
Sales (order line)✅✅✅✅✅✅
Inventory (daily snapshot)✅✅✅
Returns✅✅✅✅✅
Shipments✅✅✅

Rows = facts, columns = conformed dimensions. It shows reuse and integration at a glance. Drawing it in an interview is a strong senior signal.


5. Keys

KeyWhatWhy
Natural / business keyID from the source (customer_id = "C-1042")Identifies the real-world entity
Surrogate keyWarehouse-generated (customer_key = 98765, or a hash)Decouples from source IDs; required for SCD2 (one entity, many versions); handles multiple sources with clashing IDs; compact joins
Hash key`sha2(source_system
Degenerate dimensionTransaction ID kept on the fact with no dimension table (order_number)Grouping lines per order, drill-through to source

Unknown / ghost members: reserve customer_key = -1 (“Unknown”) so facts with missing or late dimension data still join (no inner-join row loss), and fix them later.


6. Common modeling mistakes (and how interviewers expose them)

MistakeSymptomFix
Undeclared or mixed grainTotals double countState grain; split fact tables
Facts in dimensions (e.g. customer.total_spend)Stale, inconsistent numbersKeep measures in facts; derive aggregates
Snowflaking everythingMany joins, slow BIFlatten small hierarchies into the dimension
No history strategy”What was the customer’s tier when they ordered?” can’t be answeredSCD2 or point-in-time snapshot
Using natural keys onlySCD2 impossible; source key collisionsSurrogate keys
Inner joins to dims with missing membersSilent fact lossUnknown members + left joins + DQ checks
One table per dashboardMetric drift, costConformed facts/dims + semantic layer
Nullable foreign keys in factsUnjoinable rowsDefault to unknown member key

7. Practice

Work through the data modeling case studies. Each follows this exact script.