In a Data Vault, why are hub and link keys hashed business keys?
answer
- What must happen before a sequence key can be used?
- Computable from the incoming row alone
- Which loads can then run at the same time?
- Two pipelines, two trimming rules, one bad outcome
- Same idea applied to attributes for change detection
basics
~20 sBecause a hash is computed from the business key alone, every pipeline can derive the same key without looking anything up. Hubs, links and satellites then load in parallel, in any order, across systems, with no sequence assignment step.
solid answer
~50 sA sequence-assigned key has to be issued by the hub before anything referencing it can load, which serializes the pipeline: hub first, then links, then satellites, each doing a lookup join to resolve parents. A hash key removes that dependency — `customer_hk = hash(standardized customer_id)` is computable from the incoming row by any process, in any order, on any platform, so all three table types load **in parallel**, even across separate clusters. The price is discipline. Every pipeline must standardize the business key identically before hashing — same trimming, same case, same null token, same delimiter for composite keys — or the same customer produces two different hash keys and the entity silently splits in two. Hashes are also wider than integers, so joins and storage cost more, and the values are unreadable when debugging. Satellites reuse the idea for change detection, hashing the descriptive columns into a `hashdiff`.
code
text · 7 lines-- The standardization contract every pipeline must apply identically
hub key : hash( upper(trim(customer_id)) )
link key : hash( upper(trim(order_id)) || '||' || upper(trim(customer_id)) )
hashdiff : hash( coalesce(name,'') || '||' || coalesce(tier,'') )
-- Must be written down and enforced:
-- trim/case rule, delimiter, part ordering, null tokengo deeper
Recall the basic idea: the warehouse key is computed from the business key by a hash function, so it is the same value everywhere and does not have to be issued by a table.
Be able to explain the load-order consequence — no lookup into the hub means links and satellites load in parallel with it — and to write the standardization applied before hashing.
Expect a diagnosis scenario: one customer appearing twice, or a satellite full of duplicates. Trace both to inconsistent standardization or null handling before the hash, and describe the convention that prevents them.
Own the decision itself: hashing buys distributed, restartable, cross-platform loading and costs key width, opacity and a standardization contract every future pipeline must honour. For a single orchestrated pipeline that bargain may not pay.
## The problem hash keys solve Data Vault is designed to be loaded by many independent pipelines, fed by many source systems, on different schedules. The obstacle to that is key resolution. If a hub assigns its warehouse key from a sequence, then nothing that references the hub can be loaded until the hub row exists and its key is known. Every link and satellite load must first join back to the hub to translate a business key into a warehouse key. The pipeline becomes a strict order — hubs, then links, then satellites — with a lookup at every step and a single point of contention at the sequence. A hash key breaks the dependency by making the key a **deterministic function of the business key**: ``` customer_hk = hash( upper(trim(customer_id)) ) ``` Now any process can compute the parent key for any row without consulting the warehouse at all. The satellite load and the link load do not wait for the hub load, do not join to it, and do not care whether it has run yet. Loads run in parallel and out of order, and any of them can be restarted independently. That property — not storage efficiency or index behaviour — is why Data Vault reaches for hashing. ## Determinism across systems and time The same property has a second payoff. Because the key is a pure function of the business key, it is identical in every environment and on every platform. A key computed in a staging job on one system matches the key computed by a different job, in a different tool, next year. That makes it possible to distribute the vault across platforms, to rebuild a table from source without breaking references from other tables, and to compare environments row by row. A sequence-assigned key has none of these properties: rebuild the hub and every downstream reference is wrong. ## Composite keys and the standardization contract The hash is only as good as the string fed into it, and this is where implementations actually fail. Every pipeline must apply an identical standardization rule before hashing: ``` hub key: hash( upper(trim(customer_id)) ) link key: hash( upper(trim(order_id)) || '||' || upper(trim(customer_id)) ) hashdiff: hash( coalesce(name,'') || '||' || coalesce(tier,'') ) ``` The rules that must be written down and enforced everywhere are: trimming and casing, the exact delimiter used between the parts of a composite or link key, the ordering of those parts, and the token substituted for a null or empty business key. If one pipeline trims and another does not, `C-42` and `C-42 ` hash differently, the vault silently holds two hubs for one customer, and history splits across them. The failure is silent because nothing is violated — both hubs are perfectly valid rows. Detecting it later means comparing business keys, not hash keys. The delimiter also has to be a character that cannot occur inside a key value, or two different key combinations can concatenate to the same string and legitimately collide. ## Hashdiff — the same trick for change detection Satellites apply the idea to attributes rather than keys. A `hashdiff` column holds a hash over the concatenated descriptive columns, so deciding whether an incoming record differs from the stored one is a single comparison rather than a column-by-column check across forty nullable columns. It is faster and, more importantly, it cannot be broken by someone adding a column and forgetting to extend the comparison. It carries the same standardization hazard: null and empty string must be represented consistently, or unchanged rows will look changed and the satellite will fill with spurious versions. ## What hashing costs **Width.** A hash key is far wider than an integer — sixteen or thirty-two bytes rather than four or eight. Every link and satellite carries copies of it, so storage grows and joins move more bytes. On a large vault this is a real, measurable cost rather than a theoretical one. **Opacity.** Hash values are unreadable, so debugging by eye is painful and every investigation starts by joining back to a hub to recover the business key. **Collisions.** Two different business keys hashing to the same value would silently merge two entities. With a wide digest and realistic row counts the probability is negligible, but it is not zero, and shops that care choose a wider digest rather than the shortest one available. A collision here is a data-integrity failure, not a performance problem, which is why the choice of digest width is worth a deliberate decision rather than a default. **Discipline debt.** The standardization contract must survive staff turnover and new pipelines written by teams who never read the original convention. That is a governance cost, and it is the one that actually bites. ## When the trade-off flips If the whole vault is loaded by a single orchestrated pipeline into one platform, with modest volumes and no cross-platform ambition, the parallel-loading benefit is small and the width cost is real; a sequence-assigned key with lookup joins is defensible. The larger and more distributed the loading landscape, the more decisively hashing wins.
- Two pipelines standardize the business key differently before hashing — what actually goes wrong?The same customer produces two hash keys, so the vault holds two hub rows and splits that customer's satellites and links between them. Nothing errors; every row is structurally valid. Reports quietly show one customer as two, and you only find it by comparing business keys rather than hash keys.
- Why do link tables need a hash key of their own rather than just carrying the parent hash keys?So satellites can hang off the link with a single-column parent key, and so the link's own identity is stable and comparable. It is the hash of the standardized, ordered concatenation of the participating business keys, which keeps the row's identity deterministic in exactly the same way a hub's is.
- Is hash-key collision a practical concern?With a wide digest and realistic row counts the probability is negligible, but the consequence is severe — two unrelated business entities silently merged into one hub row. That asymmetry is why the digest width is worth a conscious choice, and why teams uncomfortable with the risk pick the wider option rather than the fastest.
saying these in an interview costs you the question
- Says hashing is chosen for storage savings over integers
- Assumes hash keys remove the need to standardize business keys
- Thinks hash keys still require a lookup into the hub
- Believes a hash key encodes the source system it came from
- Claims hashing makes duplicate business keys impossible