Forum Discussion

smpa01's avatar
smpa01
Community Champion
1 year ago
Solved

Deterministic Unique IDs

I am working with a large data model and I am utilizing strings from different dimension tables in the calculation of measures.   Now, for the sake of these calculations, I need to generate a d...
  • AlexisOlson's avatar
    1 year ago
    1. In your example the strings are unique. Is this true in your real scenario?
      • If not unique, please verify whether or not duplicate rows should have matching unique ID values.
      • If unique, why do you need a unique ID column?
    2. The Pigeonhole Principle is not really part of a hash algorithm. It's a mathematical theorem that states that if you have more than N items to put into N containers, at least one container will contain multiple items (i.e. a hash collision). You are likely to get hash collisions long before you approach the number of possible hash outputs. It's just that if you go over, you're mathematically guaranteed to have them.
    3. It looks like the HASH function outputs values in the range of about ±9.2 x 1018. This is roughly the size of a 64-bit signed integer assuming it uses that full range.
    4. Check out the probability of random collisions table on Wikipedia to get an idea of how likely a collision is. For example, assuming any hash output has equal probability, and the HASH function has an output on the order of 64 bits, then you can have up to around half a billion input values with a <1% probability of having a random hash collision. Or use this tool