Bridge tables
When a many-to-many relationship needs its own grain, and when a direct foreign key is enough.
A bridge table turns a many-to-many relationship into an entity with its own grain. Use one when the relationship has history, attributes, allocation weights, or repeated rows that a direct foreign key cannot preserve.
Direct relationships
A direct foreign key is enough when one row points to one stable parent and the relationship does not need its own attributes.
Good fit:
- one account has one current primary owner
- one order line belongs to one product
- one ticket has one current queue when history is out of scope
Common mistake: adding a bridge for every join. Extra bridge tables create unnecessary grain and make simple questions harder to query.
Bridge tables
A bridge table fits when both sides can repeat and the relationship itself is what analysts need to study.
Good fit:
- accounts with multiple owners and split credit
- orders with multiple promotions
- support tickets handled by several agents over time
- patients with several diagnoses on one encounter
Common mistake: drawing a direct N:M line without a table to hold the
relationship grain. If the relationship has assigned_at, allocation_weight,
effective_from, or reason, it needs a row of its own.
Allocation and history
Many bridge rows are factless facts. They may contain only keys and dates, or they may carry measures such as allocation percent or allocated discount.
When a measure can be counted through multiple bridge rows, protect the query from double counting. Either allocate the measure across bridge rows or make the metric definition explicit about distinct counting.
Kimball multivalued dimension bridge guidance is the pattern source for this choice. dbt semantic modeling reinforces the same habit from the metrics side: metrics need entities, dimensions, measures, and relationship grain that make joins unambiguous.
Practice this concept
Challenges that apply what this lesson covers.