Database Theory: The truth about Universally Unique Identifier – UUID

Sharing one of important theory for all Database Architecture and Designer.

Generally, we have one common practice to create a sequential, unique number for a database system.

The best practice is to create an integer primary key for each and every table which represents the tuples.
But you should also know about UUID.
You can visit this article on The truth about Primary Key.

What is UUID and How it generates Unique Number?

UUID – Universally Unique Identifier has also one stand as a unique string.
A UUID is a 128 bit number and it used to uniquely identify different type of entities.
The computation of the UUID is quick and easy to generate an ID which can be reasonably assumed to be universally unique.

The UUID is globally unique, because it contains a unique combination like network address, timestamp of the transaction and other component details.
The network address and timestamp of transaction is enough to ensure uniqueness.

Example, The standard form of UUID. It is total of 32 digits and representing the 128 bits.

Why we require UUID?

When we are working in the distributed environment system, we need UUID which identifies the integrated data from the different systems.

For example,
We have two systems, System A and System B. Now I want to import some data from System A to System B without changing an ID of the source system. System B has already set of stored IDs which might conflict with System A IDs.
A UUID solves this problem.

If the system is not online, offline user also can generate a UUID at the client side for few operations.

A UUID always unique for all the systems which resides in a distributed environment.

For Example,
System A inserts a record with ID 10 and at the same time System B also inserts a record with ID 10.
Now, this is a collision.
A UUID solves this problem.

If the system is accessed by multiple threads, each thread has to wait for new IDs.
A UUID also solve this problem because it does not depend on the previously generated key.

We can generate trillions of UUID in a year and it has very less chance of duplication.

If we recreate a Database or Table, again sequential ID starts from 1. In this kind of situations, we can represent and use UUID.

Other limitations:

The index fragmentation is one of the major drawbacks of using UUID random keys.

We should not use UUID as a Primary key of a table. Still, I suggest you to create an integer sequential primary key and create a separate column for UUID.

Anvesh Patel

Leave a Reply

7 Comments on "Database Theory: The truth about Universally Unique Identifier – UUID"

Notify of
Sort by:   newest | oldest | most voted

Hello.This article was really interesting, especially since I was browsing for thoughts on this subject last Tuesday.


Normally I do not read article on blogs, but I wish to say that this write-up very forced me to try and do so! Your writing style has been surprised me. Thanks, quite nice article.


Hi there to every one, for the reason that I am actually keen of reading this webpage post to be updated daily. It contains good material.


Hi my loved one! I want to say that this article is awesome, nice written and include approximately all significant infos. IĖ‡d like to see more posts like this . šŸ™‚


Hi there to every one, since I am truly eager of reading this webpage post to be updated on a regular basis. It carries nice stuff.


great submit, very informative. I ponder why the other specialists of this sector do not realize this. You should continue your writing. I’m sure, you’ve a great readers’ base already!


hi!,I really like your writing very so much! proportion we keep up a correspondence more approximately your post on AOL? I require an expert on this space to unravel my problem. May be that is you! Having a look ahead to look you.