Out of curiosity, what makes UUIDs more elegant or beautiful than just plain old integers?
Out of curiosity, what makes UUIDs more elegant or beautiful than just plain old integers?
In a lot of cases that can be a pain due to overlapping integer primary keys and large parent-child table sets.
> To be able to generate keys independently of the database
> To move sets of related records between different databases without having to deal with renumbering everything
For most applications you are better off using a sensible structured key, like incrementing an integer or similar, and encrypting it if you want to obscure it. Encrypting a 128-bit value is approximately free on modern CPUs.
This is a must if you don't want to couple your domain logic and DB. I want to generate a record with an ID inside my domain layer without depending on the DB and doing awkward DB save - DB read.