3 ms·
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
by vkjv 9y ago
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.