Star Schemas and Dimensional Modelling

By Nembot Jules · November 15, 2026 · 41 min read

In the first post of this series, we saw why organizations separate the systems that run the business from the systems that analyse it, and we met the main warehouse architectures. One name kept coming back: Kimball, and his star schemas. Whatever happens in the integration layer, the tables that analysts and dashboards actually query are, very often, stars.

This post is about how to design them. We will start from the very beginning, what a model is, and add one brick at a time until we have a complete dimensional model, including the part that confuses most people: history, and slowly changing dimensions.

Our example: a national bank. Everything in this post is built on one example. Our bank has agencies in several cities across the country: Douala, Yaoundé, Bafoussam, Garoua. Each agency employs portfolio managers. Every customer belongs to a portfolio, and each portfolio is attached to one agency and followed by one manager. Customers hold accounts (current accounts, savings accounts, loans), and those accounts record transactions: deposits, withdrawals, transfers, fees. Every table and every query below is written for that bank.

1) What is modelling?

A model is a simplified representation of something real, built for a purpose.

Think of a city and two maps of it. A street map shows every street, every turn, sometimes every building. A metro map shows almost none of that: straight lines, evenly spaced stations, and the places where lines connect. Distances are wrong and most of the city is missing. Yet if you want to get from one station to another, the metro map is the better map, precisely because of what it leaves out.

Two maps of the same cityLeft: a street map full of curved streets and buildings. Right: a metro map with three straight lines, stations and two interchanges.Street mapMetro mapEvery street and turn.Built to walk or drive.Only lines, stations, connections.Built to choose a route.
Figure 1. Two models of the same city. Neither is the real city; each keeps what its purpose needs and leaves out the rest.

Two ideas from this example run through the whole post:

2) What is a data model?

A data model applies this idea to an organization. It is an abstraction of how the organization works: what it deals with, what happens between those things, and the rules that govern them. For our bank: there are agencies, managers, portfolios, customers and accounts; customers make transactions on their accounts; a portfolio belongs to one agency.

A data model is therefore, first of all, a written-down understanding of the business. The better you understand how the bank actually works, the more precise your model will be. The reverse is just as true: wherever your understanding is vague, your model will be vague in exactly the same place. Most bad models are not caused by bad SQL. They are caused by questions nobody asked the business.

Modelling starts with questions

Before drawing a single table, you talk to the people who run the bank. Three questions are enough to show how much the answers shape the model:

None of these questions are technical, yet each answer changes the model.

The building blocks

To express that understanding precisely, data modelling gives us a small set of concepts. There are five of them.

Entities, attributes, relationships, cardinality and keysTwo entities, Customer and Account, each with attributes and a highlighted key, linked by a relationship named holds with cardinality one to many.Customercustomer_idfull_namecitybirth_dateAccountaccount_numberaccount_typeopened_onstatusholdsrelationship1NEntitya thing the bank tracksKeyunique per accountAttributesdescribe itCardinality: one customer, many accounts
Figure 2. The building blocks of a data model on two entities of the bank. This is a first assumption: the business will soon tell us that an account can have several owners.

With these five concepts we can write down what we learned from the business. Figure 3 shows the model of our bank. Look at the account holder entity. It exists because the answer to the first question was “yes, an account can have several owners”. A many-to-many relationship cannot be stored with a single foreign key: an account cannot carry one customer key if it has two customers. So it is resolved with an entity in the middle, holding one occurrence per (customer, account) pair. The model now records a business rule that a quick look at the data might have missed.

Conceptual data model of the bankAgency employs portfolio managers and holds portfolios; a manager manages portfolios; a portfolio contains customers; customers hold accounts through the account holder entity; a product classifies accounts; an account records transactions.employs1Nholds1Nmanages1Ncontains1Nholds1NonN1classifies1Nrecords1NAgencyBonanjo, DoualaPortfolio managerMrs FotsoPortfolioa book of customersCustomerperson or companyAccount holderjoint accountsAccountcurrent, savings, loanProductthe bank's offerTransactiondeposit, withdrawal…1 = exactly oneN = manyAccount holder resolvesa many-to-many relationship:one customer, many accounts;one account, many customers.
Figure 3. The conceptual model of our bank: what exists and how it is related, in the language of the business. The highlighted account holder exists because joint accounts exist.

Three levels of a data model

A model is written at three levels of detail, going from understanding the business to building the database:

Conceptual, logical and physical modelsThe same portfolio and customer shown three times: as named boxes with a relationship, as tables with primary and foreign keys, and as a CREATE TABLE statement.Conceptualwhat existsLogicaltables, columns, keysPhysicala real enginePortfolioCustomercontains1Nportfolioportfolio_id PKportfolio_namemanager_id FKcustomercustomer_id PKfull_nameportfolio_id FKCREATE TABLE customer ( customer_id BIGINT, full_name VARCHAR(120), portfolio_id BIGINT, PRIMARY KEY (customer_id), FOREIGN KEY (portfolio_id) REFERENCES portfolio (portfolio_id));
Figure 4. The same piece of the bank at three levels: from understanding the business to building the database.

3) The main modelling approaches

Understanding the business tells you what to model. There is still more than one way to organize the tables, and the different approaches exist because they serve different purposes, exactly like the two maps. To compare them, we need one more concept.

Normalization

Normalization is the process of organizing tables so that each piece of information is stored in exactly one place. Look at this table of transactions, where each row repeats the details of the agency:

TransactionDateAmount (XAF)AgencyAgency cityAgency region
TX-12026-03-03250,000BonanjoDoualaLittoral
TX-22026-03-0340,000BonanjoDoualaLittoral
TX-32026-03-0475,000AkwaDoualaLittoral
TX-42026-03-04120,000Yaoundé CentreYaoundéCentre

The fact that Bonanjo is in Douala, in the Littoral region, is stored on every one of its transactions, possibly millions of times. If the bank reorganizes its regions, millions of rows must be updated, and if part of the update fails, the same agency ends up in two regions at once. These problems are called update anomalies.

Normalization removes them by splitting the table: transactions keep only an agency_id, and the agency’s city and region are stored once, in an agency table. Applied systematically, this leads to a series of rules called the normal forms. The usual target is the third normal form (3NF), where every column of a table describes the key of that table, the whole key, and nothing but the key.

The approaches

Four modelling approachesFour shapes: a web of small normalized tables, a star with one central table, hubs links and satellites, and one wide table with many columns.Normalized (3NF)built to write safelyDimensionalbuilt to analyseData Vaultbuilt to integrate, auditOne Big Tablebuilt for one use
Figure 5. The same business, organized four ways. Each shape follows from what the approach is built for.
ApproachBuilt forMain usersWeak at
Normalized (3NF)Writing safely, consistencyApplicationsAnalysis: many joins, technical names
DimensionalAnalysisAnalysts, BI toolsAbsorbing frequent changes in the sources
Data VaultIntegration and auditData engineersDirect querying
One Big TableOne specific useOne dashboard, one ML modelReuse, history

In a warehouse these approaches are often combined: a normalized or Data Vault layer to integrate the sources, and a dimensional layer on top for people and tools to query. Whatever is underneath, the layer analysts use is usually dimensional. It is the reference approach for analytics, and the subject of the rest of this post.

4) Dimensional modelling: facts and dimensions

Dimensional modelling starts from a simple observation: analysis is almost always about business events. A deposit, a withdrawal, a loan disbursed, an account opened. And questions about those events almost always have the same shape: how much, broken down by something. Deposits by agency. Withdrawals by month. Loans by product and region.

So dimensional modelling separates the information about each event into two kinds:

A useful test is to describe one event as a sentence. Take one deposit:

On 3 March 2026, Mrs Ngono deposited 250,000 XAF into her savings account at the Bonanjo agency, at the counter.

One deposit split into facts and dimensionsThe sentence On 3 March 2026, Mrs Ngono deposited 250,000 XAF into her savings account at the Bonanjo agency at the counter, split into pieces labelled when, who, what happened, how much, which account, where and how. Only the amount is a fact.On 3 March 2026whenMrs Ngonowhodepositedwhat happened250,000 XAFhow muchinto her savings accountwhich account, which productat the Bonanjo agencywhereat the counterhowfact: a number you measure (sum, average, count)dimension: context you filter and group by
Figure 6. One business event, described as a sentence. The measurement is the fact; everything else is context, the dimensions.

The number in the sentence is the fact. Every other part is a dimension. Notice that most dimensions are entities from our data model (the customer, the account, the agency), and the others describe the event itself (the date, the type of transaction, the channel). Dimensional modelling does not throw away the understanding we built in section 2. It reorganizes it around events.

5) The star schema

A dimensional model is stored as a star schema:

Star schema of bank transactionsA central fact_transaction table with seven foreign keys and two measures, amount and fee_amount, surrounded by seven dimension tables: date, transaction type, customer, account, product, agency and channel.dim_datedate_key PKfull_datemonthyeardim_transaction_typetransaction_type_key PKtype_namedirectioncategorydim_customercustomer_key PKfull_namesegmentportfolio_managerdim_accountaccount_key PKaccount_numberopened_onstatusdim_productproduct_key PKproduct_nameproduct_familydim_agencyagency_key PKagency_namecityregiondim_channelchannel_key PKchannel_nameis_digitalfact_transactiondate_key FKaccount_key FKcustomer_key FKproduct_key FKagency_key FKchannel_key FKtransaction_type_key FKamountfee_amount
Figure 7. The transactions star. The fact table in the centre holds one foreign key per dimension and the measurements (highlighted). Each dimension is one wide, denormalized table.

The important design choice is that dimensions are denormalized, the opposite of what we did in section 3. dim_agency holds the agency’s name, city and region in the same row, even though “Littoral” repeats for every agency of that region. dim_customer holds the customer’s segment and portfolio manager in the same row as their name. This redundancy is acceptable here for two reasons. Dimension tables are small, so repetition costs little. And a warehouse is not updated by thousands of users like an operational system; it is loaded by controlled processes, so the consistency that normalization protects is guaranteed by the load instead.

In exchange, every analytical question becomes the same simple query: join the fact table to the dimensions you need, filter, group and sum.

-- Deposits per region and month in 2026
SELECT a.region,
       d.month,
       SUM(f.amount) AS deposits
FROM fact_transaction f
JOIN dim_agency a           ON f.agency_key = a.agency_key
JOIN dim_date d             ON f.date_key = d.date_key
JOIN dim_transaction_type t ON f.transaction_type_key = t.transaction_type_key
WHERE t.type_name = 'Deposit'
  AND d.year = 2026
GROUP BY a.region, d.month;

Every join goes from the fact table to one dimension, never further. Business users can read this structure, BI tools understand it, and query engines are optimized for it.

The snowflake schema

A snowflake schema is a star whose dimensions have been normalized again: the region moves to its own table, the city to another, and the agency only keeps foreign keys to them.

Snowflaked agency dimensionfact_transaction points to dim_agency, which points to dim_city, which points to dim_region.fact_transactionagency_key FKamountdim_agencyagency_key PKagency_namecity_key FKdim_citycity_key PKcity_nameregion_key FKdim_regionregion_key PKregion_nameStar: dim_agency holds agency_name, city and region in one row, one join.Snowflake: the same information over three tables, three joins to reach the region.
Figure 8. The agency dimension snowflaked: city and region are normalized into their own tables.

It saves a little storage and keeps each attribute in one place, but every query needs more joins and the model becomes harder to read. Kimball’s advice, which I follow, is to avoid snowflaking by default, and to use it only when there is a specific reason, for example a very large dimension in which a group of attributes changes independently from the rest.

6) The four-step design process

We know what a star looks like. How do you design one? Kimball describes a process in four steps, always in the same order. Let us follow it to build the transactions star of our bank from scratch.

The four-step design processFour panels: choosing account transactions among business processes; declaring the grain as one row per transaction posted on one account; seven dimensions around a fact; the fact table with amount and fee_amount.1. Business process2. Grain3. Dimensions4. FactsAccount transactionsdeposits, withdrawals, transfers, feesLoan applicationsCustomer meetings✓one row = one transactionposted on one accountTX-88412 · ACC-1029 · 250,000TX-88413 · ACC-2201 · -100,000not one row per account per day:that is a different tabledateaccountcustomerproductagencychanneltypefactfact_transaction7 dimension keys FKamountfee_amountmeasured once per transaction(a balance is not: it belongs to an account)
Figure 9. The four steps applied to the bank, in order. Each decision depends on the one before it.

Step 1: choose the business process

A business process is an activity that the organization performs and records: taking deposits and payments, granting loans, opening accounts, meeting customers. Each process produces its own events, and each becomes its own star. You do not model “the bank” in one go; you model one process at a time.

The choice is driven by the questions the business wants answered first. Suppose management asks: how much money moves through our accounts, in which agencies, through which channels? The process is account transactions: every deposit, withdrawal, transfer and fee posted on an account.

Step 2: declare the grain

The grain is the exact meaning of one row of the fact table. It is the most important decision in dimensional modelling, because every following step depends on it.

For our process, the grain is: one row per transaction posted on one account.

Declaring the grain is, again, a matter of understanding the business. Take a transfer of 100,000 XAF from Mrs Ngono’s current account to Mr Kamga’s savings account. Is it one transaction or two? In the bank’s core system it is two postings: a debit on one account and a credit on the other. With our grain it is therefore two rows, one per account. If nobody asks the question, transfers end up either counted twice or missing one side, depending on what the first developer happened to choose.

Two rules about grain:

Step 3: identify the dimensions

With the grain fixed, ask: what describes one transaction? Every answer that has a single value for one row at this grain is a dimension. For one posted transaction we know the date, the account, the customer, the product (savings account, current account…), the agency where it happened, the channel (counter, ATM, mobile app) and the type of transaction.

The grain also rules out wrong candidates. “Number of accounts held by the customer” does not describe one transaction; it describes a customer at a point in time, and belongs elsewhere.

A note on the customer: we saw in section 2 that an account can have several owners. For now, each transaction gets one customer_key, the account’s primary holder. We will handle joint accounts properly in section 11.

Step 4: identify the facts

Finally, ask: what do we measure for one transaction? Its amount, and the fee charged on it. Like dimensions, facts must be true at the declared grain. The account balance is tempting, but a balance does not describe a transaction; it describes an account at a point in time. That is a different grain, and therefore a different fact table.

The result is the star of Figure 7: process, grain, dimensions, facts, decided in that order.

7) Fact tables in depth

The grain decides what kind of fact table you build. There are three fundamental types, plus a special case.

Three types of fact tables over one weekTop: transaction events as dots at irregular times. Middle: one balance per day in a periodic snapshot. Bottom: one loan application row whose milestones submitted, analysed, approved and disbursed are filled in during the week.MonTueWedThuFriTransactionone row per eventPeriodic snapshotone row per account per day1.20M1.45M1.45M0.98M1.10MAccumulating snapshotone row per loan applicationsubmittedanalysedapproveddisbursed
Figure 10. The same week seen by three fact tables: events as they happen, the state at the end of each day, and one row per process that is updated at each milestone.

Transaction fact tables

One row per event, recorded when the event happens. Our fact_transaction is one. Rows are inserted and never updated. Transaction tables are the most detailed and the most flexible, but some questions are expensive to answer from them: to know the balance of every account on 31 March, you would have to add up every transaction since each account was opened.

Periodic snapshot fact tables

One row per thing per period, whether something happened or not. For the bank: fact_account_balance_daily, with one row per account per day and its end-of-day balance. A dormant account with no transaction this week still gets a row every day. Snapshots answer “what was the situation at that moment?” directly, and much of banking reporting is built on them: deposits outstanding, the loan portfolio at month end, regulatory ratios.

Accumulating snapshot fact tables

One row per instance of a process with a clear beginning and end, updated as the process moves through its milestones. A loan application is a good example: it is submitted, analysed, approved, then disbursed. fact_loan_application has one row per application, one date key per milestone (submitted_date_key, approved_date_key, disbursed_date_key…) and facts such as the amount requested, the amount approved and the number of days between steps. When the application is approved, the existing row is updated. It is the only type of fact table whose rows change after they are inserted, and it makes questions such as “how many days, on average, from submission to disbursement in each agency?” easy to answer.

Factless fact tables

Some events have no measurement: they just happened. A customer met their portfolio manager on a given day, in a given agency. fact_customer_meeting has only foreign keys (date, customer, manager, agency) and no numeric column; you analyse it by counting rows. Factless tables can also record coverage, meaning what could have happened: which products each agency is allowed to sell. Compared with actual sales, it answers questions about events that did not happen, such as “which products sold nothing in Garoua this quarter?”

Additivity

Now that we have several kinds of fact tables, we can see that facts do not all behave the same way when you add them up.

Here is one account in fact_account_balance_daily:

DateAccountEnd-of-day balance (XAF)
29 MarchACC-10291,200,000
30 MarchACC-10291,450,000
31 MarchACC-10291,450,000

Summing the column gives 4,100,000 XAF, a number that means nothing: the account never held more than 1,450,000. Across time, you take the balance at the end of the period (1,450,000) or the average balance (about 1,366,667). Across accounts or agencies on the same day, summing is correct: the total balance of all Bonanjo accounts on 31 March is a real number.

For non-additive facts, the rule is to store the components, not the result. Do not store the interest rate of each loan and average it; an average of rates ignores the size of each loan. Store the interest amount and the principal, and compute the rate in the query: SUM(interest_amount) / SUM(principal).

Degenerate dimensions

One last piece of the fact table. Each transaction has a reference number from the core banking system, such as TX-88412. It is useful: an analyst investigating a suspicious transaction needs it. But it has no attributes of its own, so a dimension table for it would contain nothing but the number. We therefore keep it directly in the fact table, as a column. A dimension stored in the fact table without a dimension table is called a degenerate dimension. Transaction references, order numbers and invoice numbers are typical examples.

8) Dimension tables in depth

Fact tables hold the numbers, but dimensions hold everything users filter, group and read. A good dimension is what makes a model pleasant to use.

Surrogate keys and natural keys

In the core banking system, Mrs Ngono is identified by her customer number, CUS-0042. That is a natural key, also called a business key: the identifier of the source system, meaningful to the business.

In the warehouse, dim_customer does not use it as its primary key. The warehouse generates its own key, usually a plain integer: customer_key = 101. This is a surrogate key. It has no business meaning, it exists only inside the warehouse, and every fact table points to it. The natural key is still kept, as an ordinary column.

Why add a key when the source already has one?

The date dimension

Every fact table has at least one date, and the date is the most used dimension of all. It may seem enough to store a date in the fact table and use date functions in queries. In practice you build a dim_date table, with one row per day (ten years is only about 3,650 rows) and many attributes computed once:

date_keyfull_datedaymonthquarteris_business_dayis_last_business_day_of_monthholiday
202605202026-05-20WednesdayMayQ2NoNoNational Day
202605292026-05-29FridayMayQ2YesYes

These attributes encode business knowledge that no date function has: Cameroon’s public holidays, the bank’s business days, its fiscal calendar. “Deposits on the last business day of each month” becomes a simple filter, with the same definition in every report. The key is often the date itself written as an integer (20260520), which keeps it readable.

Hierarchies

Many dimensions contain natural levels of detail. Agencies belong to cities, and cities to regions: agency → city → region. Products belong to families: “Savings account” and “Term deposit” are deposit products; “Mortgage” and “Overdraft” are credit products. In a star, each level is simply a column of the same dimension. Users drill down from region to city to agency, or roll up the other way, just by changing the column in the GROUP BY. These levels are exactly what the snowflake schema would have split into separate tables.

Role-playing dimensions

A banking transaction has two dates. The booking date is when it is recorded. The value date is the date from which it counts for interest. A cheque deposited on a Friday may be booked on Friday but only take value on Tuesday. So the fact table needs two foreign keys, booking_date_key and value_date_key, both pointing to the same dim_date. (Our first query in section 5 used a single date_key; from now on we use the booking date.)

One physical dimension used in several roles is called a role-playing dimension. You build it once and expose one view per role, with column names that say which role it plays, so a report can filter on “value date month” without ambiguity.

A role-playing date dimensionOne dim_date table exposed as two views, booking_date and value_date, each joined to its own foreign key in fact_transaction.dim_datedate_key PKfull_datemonthis_business_daybooking_dateview on dim_datevalue_dateview on dim_datefact_transactionbooking_date_key FKvalue_date_key FKamount
Figure 11. One date dimension playing two roles. The table exists once; each role gets its own view and its own foreign key.

Junk dimensions

Transactions also carry small indicators: is it a reversal? Is it international? Was it made outside business hours? One dimension per yes/no flag would clutter the star, and many flag columns make the fact table wider for little benefit. A junk dimension groups them into one small table, with one row per combination that actually occurs (three yes/no flags give at most 8 rows). The fact table gets a single transaction_flags_key.

The unknown member

Not every transaction has every dimension. A transfer made in the mobile app does not happen in an agency. A transaction may arrive with a customer number the warehouse cannot match. Leaving the foreign key NULL is a trap: inner joins silently drop those rows, and totals stop matching the source.

Instead, each dimension gets special rows with reserved surrogate keys, for example -1 for “Unknown” and -2 for “Not applicable”. The mobile transfer points to “Not applicable” in dim_agency, and the unmatched transaction points to “Unknown” in dim_customer. Every fact row joins, totals stay correct, and reports show explicitly how much is unknown, which is itself a useful data quality indicator.

9) Slowly Changing Dimensions

The problem

Dimensions change. Not often, which is why they are called slowly changing dimensions (SCD), but they do. Back to the third question of section 2.

Until June 2025, Mrs Ngono lived in Douala, and her portfolio was managed by Mrs Fotso at the Bonanjo agency. In July 2025 she moved to Yaoundé, and her accounts were transferred to the portfolio of Mr Mbarga at the Yaoundé Centre agency.

Now the bank asks: how much did each portfolio manager collect in deposits during the first half of 2025? Mrs Ngono’s deposits from January to June were collected by Mrs Fotso. If the warehouse simply replaces “Fotso” with “Mbarga” in dim_customer, every past deposit of Mrs Ngono moves into Mr Mbarga’s figures. Mrs Fotso’s 2025 results are now wrong, and last year’s report, run again today, no longer gives last year’s numbers.

Overwriting is not always wrong, though. If the change is the correction of a typo in her name, nobody wants the misspelled name preserved on old transactions. The right behaviour is a business decision, taken attribute by attribute. The SCD types are the standard answers to that decision.

Type 0: keep the original

The value never changes in the warehouse, even if the source changes it. It is used for attributes that are fixed by definition: the date the customer joined the bank, the credit score given at onboarding.

Type 1: overwrite

The new value replaces the old one. No history is kept, and all past facts now show the new value.

customer_keycustomer_idfull_namephone
Before101CUS-0042Ngonno Marie+237 6 77 12 34 56
After101CUS-0042Ngono Marie+237 6 99 87 65 43

Use it for corrections, and for attributes where only the current value matters to analysis, such as a phone number or an email address. It is simple and cheap. Used on the portfolio manager, it produces exactly the problem described above.

Type 2: add a new row

Type 2 is the one you will use most, and it relies on the surrogate keys of section 8. When a tracked attribute changes, the current row is closed and a new row is inserted, with a new surrogate key. Three columns manage the versions: valid_from, valid_to and is_current.

customer_keycustomer_idfull_namecityportfolio_managervalid_fromvalid_tois_current
101CUS-0042Ngono MarieDoualaFotso2023-01-102025-06-30No
245CUS-0042Ngono MarieYaoundéMbarga2025-07-019999-12-31Yes

The two rows share the same natural key, CUS-0042: they are the same customer. In this role the natural key is often called the durable key, because it stays the same across all versions. The surrogate keys differ: each identifies one version of the customer. The far-future valid_to on the current row (9999-12-31) avoids NULLs in date comparisons.

The essential mechanism is in the fact table. When a transaction is loaded, it receives the surrogate key of the customer version that was valid on the date of the transaction. Deposits from March 2025 store customer_key = 101; deposits from September 2025 store 245.

Type 2 versions and the facts that point to themA timeline from 2024 to 2026. Customer CUS-0042 has version 101 in Douala with manager Fotso until July 2025, then version 245 in Yaoundé with manager Mbarga. Transactions before the move point to 101, transactions after it point to 245.customer_key 101 · CUS-0042Douala · Fotsocustomer_key 245Yaoundé · Mbargadim_customermoves on 2025-07-01time202420252026→ 101→ 101→ 101→ 101→ 245→ 245→ 245fact_transactionEach transaction stores the customer_key that was valid on its date.
Figure 12. Type 2 in one picture: two versions of the same customer, and each transaction pointing to the version that was true when it happened.
-- During the load: give each transaction the customer version valid on its date
SELECT t.transaction_ref,
       t.amount,
       c.customer_key
FROM staging_transaction t
JOIN dim_customer c
  ON  c.customer_id = t.customer_id
  AND t.booking_date BETWEEN c.valid_from AND c.valid_to;

As a result, history is correct without any effort in the queries. Grouping 2025 deposits by portfolio_manager credits Mrs Fotso until June and Mr Mbarga from July, because each fact row joins to the version that was true at the time. And when you want the whole history of Mrs Ngono regardless of version, you group by the durable key customer_id instead of the surrogate key.

The cost of Type 2 is size and complexity: each change adds a row, and the load must detect changes, close old versions and give facts the right keys. That is why you track only the attributes the business needs, not every column.

Type 3: add a “previous value” column

Type 3 keeps one previous value in an extra column of the same row. Suppose the bank reorganizes its regions, and Bafoussam moves from the “West” region to a new “West and North-West” region. For one year, management wants to see figures under both the old and the new organization.

agency_keyagency_nameregionprevious_region
12BafoussamWest and North-WestWest

Every fact, old or new, can now be reported under either organization by choosing the column. Type 3 is limited by design: it keeps a single previous value, and it suits a known, planned change rather than general history tracking.

Type 4: the mini-dimension

Some customer attributes change far too often for Type 2. Each month, the bank classifies every customer into a balance band (“under 1M”, “1M to 10M”, “over 10M”) and a risk band. With Type 2, a million customers reclassified monthly could add up to twelve million rows a year to dim_customer.

The solution is to move these fast-changing attributes into a separate, small dimension, the mini-dimension dim_customer_profile, with one row per combination of bands, not per customer. Three balance bands and four risk bands give twelve rows, however many customers the bank has. The fact table gets a second customer-related key, customer_profile_key, recording the profile valid at the time of the transaction. The main customer dimension stays stable, and the history of profiles is carried by the facts themselves.

A note on naming: some authors use “Type 4” for a separate history table that stores old versions while the main dimension keeps only the current one. The Kimball Group uses it for the mini-dimension, which is what we described here.

Types 5, 6 and 7: combinations

The remaining types combine the ones above to answer one recurring need: seeing history and the current value in the same report.

Type 6 (1 + 2 + 3). A Type 2 dimension with an extra current_ column, overwritten (Type 1) on every version of the customer. Each row keeps its historical value and also knows the latest one:

customer_keycustomer_idcitycurrent_cityvalid_fromvalid_tois_current
101CUS-0042DoualaYaoundé2023-01-102025-06-30No
245CUS-0042YaoundéYaoundé2025-07-019999-12-31Yes

A report can group 2025 deposits by city (where the customer lived at the time of each deposit) or by current_city (where the customer lives today), from the same table.

Type 5 (4 + 1). A mini-dimension (Type 4), plus a Type 1 column in the main customer dimension pointing to the customer’s current profile. Facts keep the profile at the time of the transaction; the dimension tells you the profile today.

Type 7 (dual keys). The fact table stores both the surrogate key (the version valid at the time) and the durable key (customer_id). Joining on the surrogate key gives the historical view. Joining on the durable key, restricted to is_current = 'Yes', gives the current view. It offers what Type 6 does without overwriting columns, at the cost of one more key in the fact table.

Choosing a type

The choice is made per attribute, with the business, around one question: when this value changes, should past facts keep the old value?

AttributeQuestion to the businessType
Customer since, onboarding scoreCan it ever change? No.0
Phone, email, spelling of the nameDoes the old value matter for analysis? No.1
Portfolio manager, agency, city, segmentShould past figures stay with the old value? Yes.2
Region after a planned reorganizationDo we need old and new side by side for a while?3
Balance band, risk band (monthly)Does it change too often for Type 2?4 (mini-dimension)
City, when reports need both viewsHistory and current value in one report?6 or 7

Implementing Type 2

Each time the dimension is refreshed, a Type 2 load runs in two steps. First, compare the incoming source rows with the current versions, and close those whose tracked attributes changed. Then insert a new current version for every changed or new customer. In SQL (PostgreSQL syntax):

-- Step 1: close the current version of customers whose tracked attributes changed
UPDATE dim_customer d
SET    valid_to   = CURRENT_DATE - 1,
       is_current = 'No'
FROM   staging_customer s
WHERE  d.customer_id = s.customer_id
  AND  d.is_current  = 'Yes'
  AND  (d.city IS DISTINCT FROM s.city
        OR d.portfolio_manager IS DISTINCT FROM s.portfolio_manager);

-- Step 2: insert a new current version for changed and new customers
INSERT INTO dim_customer
       (customer_id, full_name, city, portfolio_manager,
        valid_from, valid_to, is_current)
SELECT s.customer_id, s.full_name, s.city, s.portfolio_manager,
       CURRENT_DATE, DATE '9999-12-31', 'Yes'
FROM   staging_customer s
LEFT JOIN dim_customer d
       ON d.customer_id = s.customer_id
      AND d.is_current  = 'Yes'
WHERE  d.customer_id IS NULL;

The surrogate key is generated by the database, with an identity column or a sequence. Step 2 works because, after step 1, changed customers no longer have a current row, so they look exactly like new customers. IS DISTINCT FROM compares NULLs safely, where <> would miss a change from or to NULL. Many teams also compare a hash of the tracked columns instead of each column, and on engines that support it, both steps can be written as one MERGE statement.

If you use dbt, snapshots implement this pattern for you:

{% snapshot customer_snapshot %}
{{ config(
    target_schema='snapshots',
    unique_key='customer_id',
    strategy='check',
    check_cols=['city', 'portfolio_manager', 'segment'],
) }}
SELECT * FROM {{ source('core_banking', 'customers') }}
{% endsnapshot %}

On each run, dbt compares the listed columns with the current version, closes changed rows and inserts new ones, adding dbt_valid_from and dbt_valid_to columns (by default, the current row has a NULL dbt_valid_to). If the source has a reliable updated_at column, the timestamp strategy is cheaper than comparing columns. The snapshot is the history; you then build dim_customer on top of it, adding the surrogate key and the unknown member.

10) Several stars: conformed dimensions and the bus matrix

So far we have built one star. The bank has other processes: loans are disbursed and repaid, balances are measured every day, customers meet their managers. Following the four steps, each process becomes its own star: fact_loan_disbursement, fact_account_balance_daily, fact_customer_meeting.

The real value appears when these stars can be combined. A regional director wants one report: for each agency and month, the deposits collected and the loans disbursed. That is only possible if both stars describe agencies and months in exactly the same way.

Conformed dimensions

A conformed dimension is a dimension shared by several fact tables, with the same keys, attributes and values wherever it is used. There is one dim_agency, one dim_date, one dim_customer, and every star uses them. “Bonanjo” has the same spelling, the same region and the same key in the transactions star and in the loans star.

Two stars sharing conformed dimensionsfact_transaction on the left and fact_loan_disbursement on the right both point to the same four dimensions in the middle: date, agency, customer and product.dim_datedim_agencydim_customerdim_productconformed dimensionsfact_transactionbooking_date_key FKagency_key FKcustomer_key FKproduct_key FKamountfact_loan_disbursementdisbursement_date_key FKagency_key FKcustomer_key FKproduct_key FKprincipal
Figure 13. Two business processes, one set of dimensions. Because both stars use the same dim_agency and dim_date, their numbers can be compared agency by agency, month by month.

Conformed dimensions are what turn a collection of stars into a warehouse. Without them, each star is an isolated data mart with its own idea of what an agency is, and we are back to the “five versions of revenue” problem from the first post.

The bus matrix

The bus matrix is the planning tool for this. Rows are business processes, columns are dimensions, and a mark means the process uses that dimension. Note that the portfolio manager, an attribute of dim_customer in our first star, is also a dimension of its own for processes such as meetings, where the manager is directly involved.

Business processDateCustomerAccountAgencyProductManagerChannel
Account transactions●●●●●●
Daily account balances●●●●●
Loan applications●●●●●●
Loan disbursements●●●●●●
Customer meetings●●●●

Read by columns, the matrix shows which dimensions must be conformed first: date, customer and agency are used everywhere. Read by rows, it is a roadmap: each row is a star you can build and deliver on its own, one process at a time, while the shared columns guarantee that the pieces fit together. This is the bus architecture from the first post.

Drill-across

Combining stars through their conformed dimensions is called drilling across. The rule is: aggregate each fact table separately to the same level, then join the results.

WITH deposits AS (
    SELECT a.agency_name, d.year, d.month, SUM(f.amount) AS deposits
    FROM fact_transaction f
    JOIN dim_agency a           ON f.agency_key = a.agency_key
    JOIN dim_date d             ON f.booking_date_key = d.date_key
    JOIN dim_transaction_type t ON f.transaction_type_key = t.transaction_type_key
    WHERE t.type_name = 'Deposit'
    GROUP BY a.agency_name, d.year, d.month
),
loans AS (
    SELECT a.agency_name, d.year, d.month, SUM(f.principal) AS loans_disbursed
    FROM fact_loan_disbursement f
    JOIN dim_agency a ON f.agency_key = a.agency_key
    JOIN dim_date d   ON f.disbursement_date_key = d.date_key
    GROUP BY a.agency_name, d.year, d.month
)
SELECT COALESCE(dp.agency_name, l.agency_name) AS agency,
       COALESCE(dp.year, l.year)               AS year,
       COALESCE(dp.month, l.month)             AS month,
       dp.deposits,
       l.loans_disbursed
FROM deposits dp
FULL OUTER JOIN loans l
  ON  dp.agency_name = l.agency_name
  AND dp.year = l.year
  AND dp.month = l.month;

Why not join the two fact tables directly? Because they have different grains. One agency has thousands of transactions in a month and a few dozen loans. Joining them row to row pairs every deposit with every loan of that agency-month, so each deposit is repeated once per loan and each loan once per deposit, and both totals are wrong. This is called fan-out. Aggregating first brings both sides to the same grain (one row per agency and month), where the join is one-to-one and safe. The full outer join keeps agencies that had deposits but no loans, and the reverse.

11) Advanced patterns

Bridge tables: many-to-many relationships

Back to the first question of section 2: an account can have several owners. Mr and Mrs Kamga share a joint current account. So far, each transaction carried one customer_key, the primary holder. What if the bank wants deposits by customer, counting joint accounts for both holders?

The answer is the one we already found in the data model: an entity in the middle. A bridge table sits between the account and the customer dimension, with one row per (account, holder) pair. The fact table keeps its account_key, and the bridge links each account to all of its holders.

Bridge table for joint accountsfact_transaction joins dim_account, which joins bridge_account_holder, which joins dim_customer. The bridge has two rows for the joint account ACC-2201, each with weight 0.5.fact_transactionaccount_key FKamountdim_accountaccount_key PKaccount_numberbridge_account_holderaccount_key FKcustomer_key FKweightdim_customercustomer_key PKfull_nameRows of the bridge for the Kamgas' joint account:ACC-2201 · Kamga Paul · 0.5ACC-2201 · Kamga Esther · 0.5One transaction on ACC-2201reaches both holders.
Figure 14. A bridge table resolves the many-to-many relationship between accounts and customers, exactly as the account holder entity did in the data model.

The bridge comes with a risk: joining through it repeats each transaction once per holder. A 100,000 XAF deposit on the Kamgas’ account appears twice, and the bank’s total doubles. There are two ways to use it:

Both are legitimate. What matters is that each report states which one it uses.

Irregular hierarchies

The agency → city → region hierarchy is regular: every agency has exactly one city and one region, so each level is a column. Some hierarchies are not. The bank’s organization chart is one: most agencies report to a regional directorate, small satellite agencies report to a larger agency first, and the main Douala agency reports directly to head office. The number of levels varies from branch to branch. This is called a ragged or variable-depth hierarchy, and plain columns cannot represent it, because you do not know how many to create.

There are two standard solutions. If the depth is limited, flatten the hierarchy into a fixed number of level columns, and fill the missing levels by repeating the nearest value, so every level is populated:

agencylevel_1level_2level_3level_4
Douala mainHead officeDouala mainDouala mainDouala main
BonanjoHead officeLittoral directorateBonanjoBonanjo
Akwa NordHead officeLittoral directorateAkwaAkwa Nord

If the depth is truly variable, use a hierarchy bridge table, with one row for every (ancestor, descendant) pair and the number of levels between them. Summing everything under the Littoral directorate then becomes a simple join on that ancestor. In banking, the chart of accounts of the general ledger is usually handled this way.

Late-arriving data

The load process assumes that dimensions arrive before the facts that use them, and that facts arrive on time. Reality is less tidy.

Late-arriving facts. An agency in a rural area loses its connection for three days, and its Monday transactions reach the warehouse on Thursday. Loading them is ordinary, with one rule: the dimension lookup must use the transaction date, not the load date. If a customer’s version changed on Tuesday, Monday’s transactions must point to the version valid on Monday. The Type 2 lookup of section 9 already does this, as long as it compares with the business date. If the fact table is partitioned by date, the old partitions are reloaded, and any aggregate built on them is refreshed.

Late-arriving dimensions (or early-arriving facts). A customer opens an account in the mobile app and makes a deposit immediately. The transaction arrives tonight, but the customer record from the onboarding system only arrives tomorrow. Pointing the transaction to “Unknown” would lose the link forever. Instead, the load inserts an inferred member: a new row in dim_customer with the natural key found on the transaction, a new surrogate key, placeholder attributes (“Pending”) and an is_inferred flag. The fact points to it. When the real customer record arrives, the inferred row is updated in place (Type 1, since the placeholders were never real history) and the flag is cleared. The fact never has to change.

Aggregate tables

In the first post we drew an optional dotted layer on top of the stars: aggregate fact tables. With the vocabulary of this post, they are easy to define. An aggregate is a fact table at a coarser grain, built from the atomic one. agg_transaction_monthly holds one row per agency, product, transaction type and month, with the summed amounts and the number of transactions. It uses the same conformed dimensions, or reduced versions of them (a month dimension derived from dim_date), so reports can switch between aggregate and detail without changing meaning. Build aggregates only for queries you have measured as slow, and always rebuild them from the atomic facts.

12) Dimensional modelling today

Kimball’s book was published in 1996, when storage was expensive and databases read data row by row. Today’s platforms (BigQuery, Snowflake, Redshift, Databricks) store data by column, scale compute on demand and make storage cheap. Is dimensional modelling still worth the effort?

Some of its original motivations have weakened: joins are cheap, scans are fast, and a denormalized One Big Table is perfectly practical on a columnar engine. But the most important reasons were never about performance:

In practice the two coexist well: model in stars, then build wide tables from the stars where a specific dashboard or machine learning model needs one. In a Medallion architecture, the stars are the gold layer: silver integrates and cleans, gold presents the data as facts and conformed dimensions. Semantic layers, which define each metric once for every BI tool, are built on top of exactly this structure.

13) Common mistakes

14) Conclusion

We started from a question that has nothing to do with SQL, what is a model, and built one brick at a time: an understanding of how the bank works, entities and relationships, facts and dimensions, a star, and finally the decisions that keep it correct over time. Every difficult choice along the way, the grain, the SCD types, the bridge weights, was answered by asking the business, not the database. That is the idea worth keeping: a model is only as good as your understanding of what it models.

Thank you for reading. I hope this post helps you design your own models, and that the next time someone asks why the same customer appears twice in dim_customer, you know exactly what to answer. See you in the next one!

More writing

Introduction to Data Warehousing

How to build a top data engineering team