3 ms·
If Twitter is already storing the tweet timestamp, is there a reason to generate sequential IDs? It seems like they could move to a UUID scheme and protect thei
by ed312 8y ago
If Twitter is already storing the tweet timestamp, is there a reason to generate sequential IDs? It seems like they could move to a UUID scheme and protect their "firehose" from reverse-engineering.
- RhodesianHunter 8y agoThey're snowflake IDs, not exactly sequential. Timestamp bits, shifted all the way left Data center id shifted left Server id shifted left Increment this millisecond Since the left bits are the timestamp, they are date/time sortable and a much more useful index/primary key/whatever than a UUID.
- thinkloop 8y agoYou can prefix the uuid with a timestamp for the same effect without leakage. There are chronological uuid projects: https://github.com/uucid-project/spec https://github.com/uucid-project/spec
- RhodesianHunter 8y agoYou can, but why would you? You're advocating slapping lipstick on a pig not really engineered for this use case vs. using something that was designed for it. UInt64's are going to be all around more efficient.
- thinkloop 8y agoYou wouldn't, just showing that it's an easy problem to solve.
- kalleboo 8y agoIn some databases having a sequential key is valuable (e.g. Cassandra at least used to be like this)