Skip to content
About
Main content

Units, degenerate and junk dimensions

Why is a measure a number plus a unit, and what do degenerate and junk dimensions still do in a column store?

Units: a measure is a number plus a unit

There is one more silent correctness surface. A measure is a number plus a unit, and only the number is stored.

Currency is the worst case, because converting needs a rate, and the rate depends on which date:

All three are legitimate, for different questions (the amount actually received, the accounting close, the current value). The rule: store the native amount, the currency code, and the rate that was actually applied. If you store only the converted figure, the number cannot be reproduced and a restatement cannot be audited. The same applies to quantity units (kilograms versus pounds, boxes versus items).


Degenerate and junk dimensions

Both are width-management devices, and both need their justification restated for columnar storage.

Degenerate dimension

A is an identifier at fact with no attributes of its own: an order number on an order-line fact. If you promoted it to its own table, you would create a one-to-one join that carries no information. Keeping it inline is correct. Its real function is as a grain marker: it names what the row belongs to, and it lets you count distinct orders from a table whose grain is order line:

SELECT COUNT(DISTINCT order_number) FROM fact_sales;   -- orders, from line-grain data

Junk dimension

A collapses K low-cardinality flags (is_gift, is_express, is_first_order, used_coupon...) into one dimension that holds the combinations that actually occur.

In a this really narrowed the . In a , ten boolean columns dictionary-encode to nearly nothing, and unused ones are never read. So the I/O justification is gone. What survives is vocabulary consolidation: one place to name and document the flag combinations, and one FK instead of K predicates to get right. That is a human-error argument. It is weaker, but not void.

A pattern to recognize

Be explicit about this pattern, because it recurs. Several classical dimensional techniques were physical optimizations that columnar storage made irrelevant, and they persist with their original justification attached. The techniques are often still worth keeping. The stated reasons are not.

Compression (degenerate and junk): degenerate dimensions mark grain; junk dimensions consolidate vocabulary. The byte-saving rationale for both died with row storage.