4 ms·
Why do you need an internal database ID? I've gone the route of a random number only (similar to a UUID but encoded in a way similar to Youtube video IDs). I u
by athenot 7y ago
Why do you need an internal database ID?
I've gone the route of a random number only (similar to a UUID but encoded in a way similar to Youtube video IDs). I used to do the auto-incremented integer but once I got into database sharding, maintaining that global counter started getting a lot more complicated.
This lets me have inserts going to several databases without worrying about the counter. (Of course, as with any eventual consistency method, there's a mechanism to ensure no duplicates exist, however unlikely they are.)
- aaronharnly 7y agoThose integer IDs can still be pretty darn efficient for a lot of use cases.
- dexterdog 7y agoAnd inefficient in some others. It all depends on the use case.