Re:Auto increment is a terrible idea
by vkjv on Thursday November 30, 2017 @09:15AM
(#15815802)
I still like auto-increment IDs. They are small and give you a monotonically increasing value for optimistic locking.
If you need multi-DC uniqueness. I prefer to add a 2nd DC column. The combination of the two is unique across DC.
If you need to hide the count from customers--often the case--add a 2nd surrogate unique key that is a UUID. This keeps your joins small, but gives you a random key to give back to the customer.
If you need multi-DC uniqueness. I prefer to add a 2nd DC column. The combination of the two is unique across DC.
If you need to hide the count from customers--often the case--add a 2nd surrogate unique key that is a UUID. This keeps your joins small, but gives you a random key to give back to the customer.