There are several applications in which you want to use a globally unique identifier (UUID / GUID):
- You expect (or use) a scaling strategy to scale records. You do not want the fragments nodes to duplicate keys .
- You want to safely port data from one node to another save keys . This is important if you want to maintain external relationships within the tact.
- Your application is also used offline ( internal sales , home repair , etc.), where the offline application periodically synchronizes with the "source of truth." You want these offline keys to be unique without making a remote call. Otherwise, you will have to develop a strategy for reorganizing keys and relationships along the way. Using a strategy of automatic growth and depending on the DBMS used, this is most likely a non-trivial task.
If you do not have a precedent from above or something similar, you can use the auto-increment identifier, if it is convenient for you; however you can still consider the UUID / GUID
Trade:
There are many opinions on the speed / size of UUID / GUID keys. After all, this is a compromise, and there are many ways to gain or lose speed using a database. Ideally, you want your indexes stored in RAM to be as fast as possible; however, this is a compromise that you must weigh against other considerations.
Other considerations regarding UUID / GUID:
- Many RDBMSs can create UUIDs.
- You can also create UUIDs through your application (you are not tied to an RDBMS for generation).
- Developers / testers can easily transfer data from environment to environment and work on a project. This is a often ignored precedent; however, this is one of the strongest cases of using the UUID / GUID strategy.
- There are databases optimized for offline use ( CouchDB ), where the UUID is what you get.
source share