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

Excellent post, write ups like this are the reason I keep coming here.

What about the hi/lo algorithm as a middle ground?

https://vladmihalcea.com/2014/06/23/the-hilo-algorithm/

In short, and I hope I don't oversimplify, each "shard" or "cluster" in the database gets a "block" of ids it can then go and assign on their own, the sequential "atomic" increase happens only once per hi "block", lowering the contention.

This gives you nice integers, incremental-ish most of the time.

I like the notion of integers internally and UIID (as integers of course! I would have never saved one as a varchar, I swear! ok, I was a noob... I deserve to be shamed)

Great post all in all!



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

Search: