Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Warehouses, Marts and Lakes  ›  Lesson

Data Marts

Data Mart 12 minA data mart is a focused subset of warehouse data shaped for one team, and building marts from the shared core with conformed dimensions keeps their numbers consistent.

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.

Building the ops martStep 1 of 4
  1. Who is it for?

    The operations team, who plan van routes to rebalance bikes.

Drills

Answer fast — trust the rule.

quick drill

What is a data mart?

quick drill

Finance and ops each built their own mart directly from the app database, and their ride counts differ. What went wrong?

quick drill

What is a conformed dimension?

quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainDesign a mart

Marketing wants a mart to track rider sign-ups and how many riders take a second ride within 30 days. Describe what the mart would contain, what it should read from, and how you would make sure its numbers agree with finance and ops.