Skip to the workspace
Pebellslearn by building
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 engineer / Data Marts

Explore each scene at your own pace.

01 · The rule

The rule

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.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.