Re:How many ways are there to sort GUIDs?
by jeltz on Tuesday April 30, 2019 @06:18AM
(#19786603)
Why do you use UUID's for keys? Unless you have many data sources which you need to aggregate using a 64-bit autoincremenet key is probably the best solution. 64-bits is enough for almost everything. They can be worth using if you have many data sources, but otherwise not really.
[ Parent
| on HN ]
Re:How many ways are there to sort GUIDs?
by marcus_holmes on Tuesday April 30, 2019 @07:45AM
(#19787033)
1. I have parallel processes that create records on the same table at the same time.
2. In some cases, I want to create the key in code and send it to the database, rather than fetching the key after the insert.
3. I want to know that if I mess up and send a document_id where I meant to send a user_id and vice versa, it's going to report "no match" rather than create a security breach by exposing one user's records to another user.
that's the main reasons anyway
Another common reason is that on distributed databases you often don't want your data stored in the same chunk/shard as the last one. You want to spread out your writes.
This of course is not good design if your access patterns involve a lot of sequential reads, so you have to be aware of what you are going to do.