Jaco van der Laan

Solving Many-to-Many & Drill-Across with the Unified Star Schema

30/09/2025  ·  Data Modeling  ·  Data Models

dbt metadata
‹ ›

Layer a Unified Star Schema (USS) bridge on top of your snapshot stars to enable safe drill-across and handle M:N relationships cleanly.


Solving Many-to-Many & Drill-Across with the Unified Star Schema

Layer a Unified Star Schema (USS) bridge on top of your snapshot stars to enable safe drill-across and handle M:N relationships cleanly.

Series Overview

From Historized 3NF to Fast, Governed Analytics — A Metadata-Driven Journey (5 parts)

  1. Why Start from a Business-Shaped, Historized 3NF
  2. Generating Dimensional Models Automatically
  3. Automating with Metadata & dbt
  4. Solving Many-to-Many & Drill-Across with the Unified Star Schema ← you’re here
  5. Putting It All Together

⚡ Recap from Part 3

We stopped hand-coding stars by exporting metadata and generating snapshots & facts/dims with dbt.
But analysts still face:

  • Fan traps / chasm traps
  • Many-to-many explosions (e.g., Policy ↔ Coverage ↔ Claim)
  • Fragile joins across multiple facts

The Unified Star Schema (USS) , introduced by Francesco Puppini, fixes this with a single semantic bridge.


🌉 The Unified Star Schema Bridge

The USS Bridge:

  • Has one row per entity per snapshot date
  • Provides a single safe join path to any fact or dimension
  • Neutralizes fan/chasm traps and M:N row explosion
  • Analysts (or BI semantic layers) start at the bridge and hop once to facts or dims.

🧩 Building a USS Bridge with Snapshots

Because every SCD2 table is already converted to a snapshot view , building the bridge is straightforward:

CREATE OR REPLACE VIEW semantic.uss_bridge AS  
SELECT 'customer' AS entity_type,  
       snapshot_date,  
       customer_sk AS entity_sk,  
       business_key  
FROM snap.d_customer  
UNION ALL  
SELECT 'product', snapshot_date, product_sk, business_key FROM snap.d_product  
UNION ALL  
SELECT 'policy',  snapshot_date, policy_sk,  business_key FROM snap.d_policy;
  • **entity_type** identifies the source dimension/fact domain.
  • **entity_sk** = SCD2 surrogate key.
  • **snapshot_date** keeps PIT alignment.
  • Add role_name if the same dimension appears in multiple roles.

🔗 How Queries Work

SELECT  
    t.date,  
    c.customer_name,  
    SUM(fc.claim_amount) AS total_claims  
FROM semantic.uss_bridge b  
JOIN snap.d_customer c  
  ON b.entity_type='customer'  
 AND b.entity_sk   = c.customer_sk  
 AND b.snapshot_date = c.snapshot_date  
JOIN snap.f_claim_participation fc  
  ON fc.snapshot_date = b.snapshot_date  
 AND fc.customer_sk   = c.customer_sk  
JOIN d_time t ON fc.snapshot_date = t.calendar_date  
GROUP BY 1,2;
  • One hop from bridge → fact/dim = no accidental M:N explosion
  • Snapshot_date guarantees temporal consistency
  • Analysts can safely mix multiple facts (Claims, Policies, Premiums…)

🏗 Where It Fits

Historized 3NF (bi-temporal SCD2)  
         ↓ metadata  
PIT Tables  
         ↓  
Snapshot Views (per entity/fact)  
         ↓  
Auto-generated Star Schemas  
         ↓  
Unified Star Schema Bridge  
         ↓  
BI / Semantic Layer (Looker, Power BI, Mode…)
  • Snapshots solve temporal complexity
  • USS Bridge solves cross-fact complexity

Figure 4 — USS Bridge over Generated Stars


🌟 Benefits

  • Safe drill-across: no fan/chasm traps
  • Governed: SCD2 + PIT alignment stays intact
  • Agile: add new entities to the bridge without rewriting ETL
  • BI-friendly: semantic tools & metrics layers start from one place

🔮 Next: The Complete Picture

In Part 5,Putting It All Together, we’ll bring it all together — Historized 3NF → PIT → Snapshots → Auto Stars → USS Bridge → Semantic Layer & BI — and show how this pipeline supports governance, agility, and AI-ready analytics.


📜 Summary

The Unified Star Schema adds a semantic safety net over your automatically generated stars. It unifies navigation, solves many-to-many joins, and makes cross-fact analysis reliable.


✅ Key Takeaways

  • A USS Bridge provides one safe join path across facts & dims
  • It leverages your snapshot & PIT pattern — no extra SCD logic
  • Analysts and BI tools can drill-across without fan/chasm traps
  • Add entities to the bridge incrementally as your model grows

👉 Next in the Series

Part 5 — Putting It All Together