Data Marts
PedalCity's finance team only cares about revenue, refunds and fees. The ops team only cares about rides, docks and van routes. Both find the full warehouse, with its hundreds of tables, hard to navigate. A data mart gives each team a small, focused corner shaped around its own questions.
The rule
A data mart is a focused slice of the warehouse, shaped for one team.
A mart contains only the tables one group needs, named in that group's language and often pre-summarised:
CREATE TABLE finance_daily_revenue AS
SELECT d.calendar_date,
s.zone,
SUM(f.fare) AS gross_revenue,
SUM(f.refund_amount) AS refunds,
SUM(f.fare - f.refund_amount) AS net_revenue
FROM fact_rides AS f
JOIN dim_date AS d ON d.date_key = f.date_key
JOIN dim_station AS s ON s.station_key = f.start_station_key
GROUP BY d.calendar_date, s.zone;There are two ways to build marts, and the difference is important:
- Dependent marts are built from the warehouse's core. Finance and ops read different marts, but both trace back to the same
fact_rides, so their ride counts agree. - Independent marts are built straight from the sources, skipping the warehouse. They are quick to set up, but each team cleans the data its own way, and soon finance and ops disagree about how many rides happened.
The two classic warehouse architectures differ mainly in the order of building. One builds a central, normalized warehouse first and derives marts from it (top-down). The other builds marts one subject at a time as star schemas that share the same conformed dimensions, such as one dim_date and one dim_station used by every mart (bottom-up). Either way, shared dimensions are what keep the numbers consistent.
The shortcut
For any proposed mart ask "Who is it for, and what does it read from?" It should be for one team, and it should read from the core, not from the raw sources.
Who is it for?
The operations team, who plan van routes to rebalance bikes.
Drills
Answer fast — trust the rule.
What is a data mart?
Finance and ops each built their own mart directly from the app database, and their ride counts differ. What went wrong?
What is a conformed dimension?
Which is the best source for a new marketing mart?
Remember
- A data mart is a focused slice of the warehouse, shaped for one team.
- Build marts from the core (dependent), not straight from sources.
- Conformed dimensions keep different marts consistent.
