Database – UUID vs Integer for Primary Keys

databaseuuid

For a database. Should I use an UUID or an integer for the primary key?

I will never exceed 2^32 in amount of rows, so an integer should be more than plenty.

I would prefer to use an integer, as I find it easier to work with, especially when using different languages.

Question: What is the advantage of UUIDs over integers?

Best Answer

The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. (Wikipedia)

UUIDs are merely integers that are picked at random by nodes that cannot necessarily communicate with each other, so they are only very, very likely to be unique rather than guaranteed. If you're programming a NON-distributed system, there is no advantage.