4 ms·
This seems overly complex, and you need some kind of key too. Why not just hash it with pretty much any hash function?
by MattPalmer1086 3y ago
This seems overly complex, and you need some kind of key too.
Why not just hash it with pretty much any hash function?
- bajsejohannes 3y agoBecause a hash is (by definition) a one-way function. You need to be able to go the other way for incoming ids.
- MattPalmer1086 3y agoAh, good point. Hadn't thought about the opposite direction.
- oconnore 3y agoA hash is not reversible, so you’d need a database index to recover the original efficient-to-index identifier, which misses the whole point ;) If you didn’t care about index clustering then just use UUIDv4
- masklinn 3y agoAlthough you could use a hash index to avoid the more deleterious effects of insertion, as long as you don’t need a unique constraint anyway…