Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This seems overly complex, and you need some kind of key too.

Why not just hash it with pretty much any hash function?



A 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


Although 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…


Because a hash is (by definition) a one-way function. You need to be able to go the other way for incoming ids.


Ah, good point. Hadn't thought about the opposite direction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: