7. Physical models: one logical model, four physical designs
A logical model says what the data is; a physical design says how one database stores it, for one job. The same model becomes a normalised schema, a star, a Data Vault or Delta tables in a medallion, and each answers the same question at a different cost.
- Theory 3: Conceptual, logical and physical models
- Theory 4: The relational model and keys
- Theory 5: Normalisation: 1NF to BCNF and 4NF, and when to denormalise
- Theory 6: Dimensional modelling: facts, dimensions, grain and slowly changing dimensions
- Theory 7: Inmon's enterprise warehouse and Data Vault 2.0
- Theory 19: Storage: OLTP and OLAP, row and column stores, Parquet
The clip starts from chapter 6's logical model: customers, products, policies, claims and claim payments. It is generated four ways side by side: a normalised schema, a star schema with a fact table and dimensions, a Data Vault of hubs, links and satellites, and Delta tables in bronze, silver and gold. Each is asked the same question, claims and their incurred cost by product line for losses in 2024; the number of tables, joins and rows each reads is shown, and all four give the same answer.
The idea: one meaning, stored for a purpose
The logical model (chapter 6) is the same whatever you build. The physical design decides how one platform stores it, and that depends on what the data is for. Four designs cover most of what Alex will meet:
- Normalised (third normal form): one table per entity, each fact once, keys enforced. It is built for the systems that write the data: a change touches one row, and the database refuses a claim for a policy that does not exist.
- A star schema (Ralph Kimball): a fact table of events (claims, payments) surrounded by dimensions that describe them (product, customer, date). Descriptions are copied into the dimensions on purpose, so every report has the same simple shape.
- A Data Vault (Dan Linstedt): hubs hold the business keys, links the relationships between them, and satellites the details, each row with its source and load date. Nothing is updated in place, so every change is kept, and a new source adds tables without changing the old ones.
- Delta tables in a medallion: files land as they are in bronze, are cleaned and typed in silver, and are shaped for one use in gold. Delta Lake's transaction log makes each folder of files behave as a table (chapter 4).
These are not rivals: an estate usually has several. Inmon's enterprise warehouse is normalised or a Data Vault at its core, with Kimball's stars on top for reporting, and a lakehouse's gold layer is often a star.
A worked example: one question, four designs
In the clip, Harbour Mutual's five entities are generated four ways from the same seeded rows. The normalised design has 5 tables, the star 4, the Data Vault 12 and the medallion 9. Each is asked: claims and their incurred cost by product line, for losses in 2024.
| Design | Tables read | Joins | Rows read |
|---|---|---|---|
| Normalised | 4 | 3 | 189 |
| Star schema | 3 | 2 | 1,527 |
| Data Vault | 5 | 4 | 249 |
| Delta tables in a medallion | 1 | 0 | 12 |
| Product line | Claims | Incurred (paid plus reserve) |
|---|---|---|
home | 9 | €50,450 |
motor | 9 | €27,650 |
travel | 6 | €27,500 |
The answer is the same everywhere; the work is not. The star reads one fact table and two small dimensions. The Data Vault joins five tables to put the claim, its policy and its product back together, which is why nobody reports from a vault directly. The medallion did its joins once, when it built the gold table, so the question reads a handful of rows. Run each one below: the tables are created in your browser and loaded from the same seed.
This design has 5 tables. The question reads 4 of them, with 3 joins and 189 rows read.
The tables, as PostgreSQL:
CREATE TABLE customers (
customer_id INT NOT NULL,
name TEXT NOT NULL,
country TEXT NOT NULL,
PRIMARY KEY (customer_id)
);
CREATE TABLE products (
product_id INT NOT NULL,
line TEXT NOT NULL,
name TEXT NOT NULL,
PRIMARY KEY (product_id)
);
CREATE TABLE policies (
policy_id INT NOT NULL,
policy_number TEXT NOT NULL,
customer_id INT NOT NULL,
product_id INT NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
PRIMARY KEY (policy_id),
FOREIGN KEY (customer_id) REFERENCES customers (customer_id),
FOREIGN KEY (product_id) REFERENCES products (product_id)
);
CREATE TABLE claims (
claim_id INT NOT NULL,
claim_number TEXT NOT NULL,
policy_id INT NOT NULL,
loss_date DATE NOT NULL,
cause TEXT NOT NULL,
reserve DECIMAL(14,2) NOT NULL,
PRIMARY KEY (claim_id),
FOREIGN KEY (policy_id) REFERENCES policies (policy_id)
);
CREATE TABLE claim_payments (
payment_id INT NOT NULL,
claim_id INT NOT NULL,
paid_on DATE NOT NULL,
amount DECIMAL(14,2) NOT NULL,
PRIMARY KEY (payment_id),
FOREIGN KEY (claim_id) REFERENCES claims (claim_id)
)PostgreSQL starts in this browser when you press Run.
| Table | PGlite | Seed | Same |
|---|
Choose a design to see its tables as PostgreSQL, its query and its cost, and run it in your browser on PostgreSQL 18.3 (PGlite). The medallion runs here as PostgreSQL schemas; its Spark SQL with Delta Lake is shown beside it and runs on Spark 4.0.1 with Delta Lake 4.0.1 in the lab's checks.
Why it matters for Alex
Alex came from BI, so the star schema feels like home, and Alex will be tempted to see every problem as one. The merger needs more than that: an integration layer that keeps every change while two estates move under it, and reports that stay simple. Knowing what each design is for lets Alex say "a vault underneath, stars on top" and explain the cost of each layer before anyone builds it.
It also gives Alex the words for the arguments ahead. "Why are there twelve tables for five things?" has an answer (history and new sources), and so does "why can't the board read the vault?" (it was never meant for reading).
Where it goes wrong
- One design for every job. A star used as the system of record loses history and rules; a normalised schema used for reporting makes every analyst write the same five joins.
- A vault nobody can read. A Data Vault without stars or gold tables on top is an archive, not a platform.
- Keys only in the diagram. Delta tables do not enforce primary or foreign keys, so a lakehouse that does not check them in its pipeline gets orphans silently.
- Gold for every question. A gold table per report is fast and quickly becomes hundreds of tables nobody owns. Build gold for the questions that matter, and let a semantic model do the rest (chapter 9).
Exercises
The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.
Choose the physical design
Which physical design fits the brief: normalised, a star schema, a Data Vault or Delta tables in a medallion? Pass all 3 situations to complete it.
Harbour Mutual is replacing the policy system's database. Staff and brokers make thousands of small changes a day, and a policy must never point at a customer who does not exist.
Recognise the design from its tables
Each table below comes from one of the four designs in the clip. Choose the design it belongs to.
claim_payments
fact_claim
dim_date
hub_claim
link_claim_policy
sat_product
bronze.claims_raw
gold.claims_by_line_year
Make the extract a star
The board's report reads one wide table, with the product's and the customer's details copied onto every claim. Make it a star: the claim stays a fact with its reserve, and the product and the customer become dimensions it refers to.
The lab checks that:
- The fact keeps its measure.
- The product line lives in a dimension the fact refers to.
- The customer's name lives in a dimension the fact refers to.
- Every dimension is one hop from the fact: no dimension refers to another table.
- No description is left on the fact.
On Azure
Each design has a natural home on Azure:
- Normalised: Azure SQL Database or Azure Database for PostgreSQL flexible server, which enforce primary and foreign keys, for the systems that write the data.
- Star schema: a warehouse in Microsoft Fabric, or gold tables in a Fabric lakehouse or on Azure Databricks, read by a Power BI semantic model. In the Fabric warehouse, primary and foreign keys can only be declared NOT ENFORCED (chapter 6).
- Data Vault: no Azure service is a Data Vault; it is a pattern you build, most often as Delta tables in the silver layer on Fabric or Azure Databricks, loaded by pipelines that compute the hash keys.
- Delta tables in a medallion: a Fabric lakehouse on OneLake, or Azure Databricks with Unity Catalog on Azure Data Lake Storage Gen2. Both store tables in the open Delta Lake format.
Delta tables on both platforms enforce NOT NULL and CHECK constraints but not keys, so the lab's generated Spark SQL writes the keys into comments and the pipelines check them (chapter 17). Layout features such as liquid clustering on Azure Databricks or V-Order in Fabric speed up reading; they change how files are written, not what the design means.
Take it to work
Physical design decision
Write down which physical design a platform uses for which job, and why.
The job
- Who writes this data, and how often?
- Who reads it, with which questions?
The design
- Normalised, star, Data Vault or medallion layer: which one, and for which tables?
- Which rules does the database enforce, and which must the pipeline check?
The cost
- How many tables and joins does a typical question need?
- What is copied, and who keeps the copies in step?
The trace back
- Which entities of the logical model does each table implement?
Tools in this chapter
- Model studio · Draw conceptual, logical and physical models, generate DDL for PostgreSQL, Spark SQL and T-SQL, and run it on Harbour Mutual's data in your browser.
Terms taught here: Physical modelStar schemaFact tableDimensionData Vault