# Don't rush to create a table yet; first explain what this row is.

Date: 2025-01-01
Category: Interview Preparation
Tags: Data Products, Data Warehouse Modeling, Interviews
Summary: When a business stakeholder says \"just create a table,\" what lies behind it is a trade-off over granularity, metric ownership, and backfill cost. This article explains what to ask first, and when to say no.

This question looks like it's testing SQL: the business side says they want "each user's order count over the last 30 days," so build a table.

Many candidates immediately type out `CREATE TABLE`, with complete fields and thorough comments. I usually stop them and ask two questions first: what is one row of this table, and will this definition be used by a second person later.

After ten years in AI products, I've seen too many requirements like this—surface-level technical work with definition ownership underneath. The same sentence gets written into SQL three times across three reports, and three months later there are probably three different numbers, then a room full of people meeting to discuss who's right. What a data product manager actually delivers at this layer isn't the table schema—it's ownership of the definition.

> Post 5/10 in this series · [Previous: The four most common mistakes in A/B test interview questions](/2025/02/24/data-pm-interview-ab-test-traps/) · [Next: The boss wants a dashboard—I look at the decision context first](/2025/10/22/data-pm-interview-dashboard-prd/)

## What one row is must be written down first

"What one row is" is the one thing I force into the first line of the design doc.

The same requirement can be built at least three ways. One row per user, with a 30-day count field; one row per "user × stat date," storing a rolling 30-day snapshot each day; or simply one row per order detail, letting the upper layer aggregate itself.

All three can produce that number, but their capabilities are completely different. The first only answers "what is it now"—once you query it, it's gone. The second can draw trends and trace back to any day to see what the definition looked like then. The third is the most flexible, at the cost of the highest query cost and the highest risk of the upper layer each writing its own definition.

If the grain is undefined, every downstream join is a hazard. If the user dimension table is one-to-many (say, a user has multiple level-change records), joining it directly to a "user × date" summary table will silently double the row count without any error. This "degradation without an error" is what I discussed in post 3—it's the hardest thing to catch in production. So the design doc must specify: how the dimension table picks the currently valid row, or how to fetch the historical version as of when the event occurred.

There's also a set of definitions that must be decided at this layer. Is 30 days a natural day within a calendar month or a rolling window, and does it include today; does "order" mean order created or payment succeeded; do cancellations, refunds, split orders, and gifts count; whose day boundary applies across time zones. These sound like technical details but actually determine whether this number reconciles with finance and with the ops daily report. I write each field as a plain-language definition, then add a counterexample—when this record should not be counted. A field you can't write a counterexample for usually means the definition isn't clear yet.

Grain is the step most easily skipped in interviews. Many people immediately recite star schema, snowflake schema, degenerate dimensions—the terms are all correct, but ask them what one row of this table is and they can't answer. Models are means; grain is a commitment. Once the commitment is vague, every later discussion rests on an undefined number.

## Four layers, so changes land in only one

Layering isn't for tidiness.

| Layer | Grain | Responsibility | What I don't allow |
| --- | --- | --- | --- |
| ODS | Same as source system | Land as-is, keep before/after change images | Cleaning, deduplication, renaming fields here |
| DWD | One row per business event | Clean, dedupe, unify IDs and time definitions | Stuffing business rules and policy definitions here |
| DWS | Subject × stat grain | Light aggregation by user, product, store, etc. | A pile of custom fields for one dashboard |
| ADS | Facing a specific application | Wide tables, metric results, dashboard queries | Redefining the definition all over again |

The most practical value of this split is reuse and accountability. The "payment succeeded" definition is defined once in DWD; the DWS user daily summary computes from it; ADS only presents the numbers. When the definition changes someday, you change one place, assess downstream, and leave a change log—rather than playing spot-the-difference across five SQL queries.

The layer most prone to trouble is actually ADS. When rushing a dashboard, someone writes a `case when` into the wide table to "fix" the definition, and the same metric no longer matches across two dashboards. This kind of discrepancy doesn't throw an error—it just erodes the business side's trust in the data bit by bit, and rebuilding trust costs far more than fixing one SQL query.

There are three engineering things I'll also probe.

### Idempotency and backfill

Partitions are organized by `dt`, and rerunning the same day's job must produce the same result. "Delete then insert" alone isn't enough—a rerun must not depend on external state, or the same job run today and tomorrow gives two different answers.

Late-arriving data is normal: clients report offline later, payment callbacks are delayed, refunds happen days afterward. So the backfill window must be agreed in advance—recompute the last N days daily, and anything outside the window goes through a separate backfill process with an audit trail. How long the window is depends on the business; longer isn't automatically safer—recomputing seven days versus ninety days differs by an order of magnitude, and partition pruning isn't a silver bullet—bytes scanned still hit your cost.

### Snapshot or stream

For mutable attributes like user level or store ownership, whether to take "the value when the event occurred" or "the current value" depends on what question you're answering.

For historical monthly regional performance, using current ownership assigns all performance before and after a store migration to the new region—it looks like a number, but it's cleanly wrong, and nobody will suspect this kind of error. For such fields I prefer to denormalize the value-at-the-time into the fact table and document that it's a snapshot, so nobody later assumes it reflects the current state in real time.

### Timeliness and cost

Whether T+1 is enough depends on how high-frequency the decisions this table supports are. For routine business reviews, T+1 is entirely sufficient; only inventory and ad spend during major promotions need a real-time pipeline, and the complexity, cost, and definition-consistency price of that pipeline must be accounted for separately—not just "how much faster." Whether to denormalize wide tables for query speed or join at query time for storage savings should be decided by "who can wait, who uses it daily," not by technical preference.

There's also an easily overlooked scale issue here. One row per user per day—a million users is over 300 million rows a year, and piling on wide-table fields means storage and scan costs must be calculated seriously. It's not that you can't build it, but you should first know why you're paying this bill and who will come query it.

## Some requirements I deliberately don't build tables for

One-off data pulls, hypotheses during validation, annual reports produced once a year—I don't build tables for these. First pull the numbers with a commented ad-hoc SQL, and record the definition and results in the request ticket. Once it's used a second time, then put it on DWS as a formal table.

The reason is practical. Once a table is built, it has an owner, a schedule, downstream dependencies, monitoring alerts, and a group of people who assume it's always correct. But early-stage definitions often change three times within a month, and each change requires a downstream assessment. I've seen plenty of tables sitting in data warehouses that "seemed like they'd be used later"—nobody dares delete them, nobody knows which are still being read, and they all end up as legacy tables nobody maintains and few query.

I boil the criterion down to two questions: will this definition be used a second time, and who's accountable if it's wrong. If both can be answered, model it properly, write the data dictionary, assign an owner, and add quality checks (row-count fluctuation, primary key uniqueness, null rate). If either can't be answered, don't let it into the schedule yet.

Not many candidates proactively mention in interviews that "tables also need a deprecation mechanism." Field lineage, last access time, deprecation notices, retirement dates—these aren't just the private concern of a data warehouse engineer. Data assets, like any other product feature, need subtraction; otherwise maintenance costs will slowly eat up all new requirements, and they'll do so quietly.

So when I hear "let's build a table" again, my first question is still: first tell me, what does this row represent?
