Junk dimensions
Collect scattered boolean and low-cardinality flags into one compact junk dimension.
Concept
junk-dimensions
The primary modeling idea this problem reinforces.
Requirements
3
Business needs the model must satisfy.
A sales fact has accumulated several low-cardinality flags (gift, promo, and sales channel) directly on the fact. Analysts want to filter and group by these flags, but the fact keeps widening as new flags appear.
A junk dimension collects unrelated low-cardinality flags into one small dimension. It keeps the fact narrow and gives flags a stable home instead of a column sprawl that grows with every new indicator.
- Create a junk dimension that holds the combinations of gift, promo, and channel flags.
- Reference the junk dimension from the sales fact with a single surrogate foreign key.
- Declare an N:1 relationship from the fact to the junk dimension.
Template
Junk dimension starter
The model users start from in the full workspace.
Entities
2
Seeded tables visible in the public preview.
Dialect
postgresql
Generated SQL target for this starter model.
This preview is read-only. Open the workspace to edit and verify; saving needs a free account.
Open workspaceTry the question first.
The discussion has other people's approaches and solutions. Give it a real attempt before you read them.