Enroll in Selenium Training

In the field of computer science, duplication of the data is a major problem. Duplication means some duplicate data present in the database. When we have some duplicate data in the database, it is obvious to mistake one data for another. For a user, you might see something else but was supposed to see something else. This problem arises as the data is not under the control of the engineers but with the users. So to overcome this, we started to take one field as the only identifier to the entire data. We generally call it an ID or identifier. But, as the population has grown and the users using the database, directly and indirectly, have grown, we have started to see the duplication of ID. Someone sitting somewhere at some time might produce the same data and store it in a database, creating confusion once again. To overcome this, the engineers used Global Unique Identifiers about which we will study in this tutorial. Just to show the index, we will cover the following in this tutorial:

  • What is GUID?
    • How many versions does GUID have?
  • What is the structure of GUID?
  • Why do we need to use GUID?
    • Advantages of GUID.
    • Disadvantages of GUID.

Once we cover the above-said points, we can move ahead with using GUIDs in Postman as it will be clear what and why we need to use it.

What is GUID?

GUID stands for Global Unique Identifier. Many times it will also be referred to as UUID or Universally Unique Identifier. There is no hard science in decoding the meaning of GUID by its name. A GUID is an identifier which is globally unique. This means that even though many people will be generating the GUID at the same time, the probability of them being the same is extremely rare. If I can tell you about the possibility, there are more chances of the earth being hit by a meteor than both the GUIDs being the same. There is less number of sand grains on earth than the GUIDs available. This reduces the probability to close to none of the collision. Since the probability is so less, there is no need for any authority to monitor, assign and control these identifiers. No matter how or when you generate a GUID, it will always be unique. You must be wondering how is this possible. We will see it in the next section when we will learn about the structure of GUIDs. Before that let me briefly mention the types of GUIDs. Although the detailed meaning is not required, they are just for your knowledge.

How many versions of GUIDs are there?

GUIDs follow the structure defined in RFC4122. So, as defined in RFC4122, GUID has five versions. I have noted down below the serial number of version and the heart of that version that uniquely defines it. If you want to learn more about the versions, please refer to the RFC4122 documents.

Version 1: Uses Date-Time and MAC Address.

Version 2: Uses DCE Security. It should be noted that this version is not defined in the RFC4122 document. It is considered to be sub-part of version 1 since it has some minor changes in the first four bytes of the GUID. But it is commonly referred to as version 2.

Version 3: Uses MD5 hash and namespace in the generation.

Version 4: Generates random digits to create a GUID except for 6 bits which are specific to version and variant bits.

Version 5: Uses SHA-1 hash and namespace in the generation. Similar to version 3 except the hashing algorithm.

Let us now see the structure of GUID to know how does it look like and the meaning of different parts of GUID.

Structure of GUID

Structure of a GUID is straightforward simple and very easy to generate. GUID is a 128-bit combination. The basic skeleton structure is as follows:

GUID

For example, if I take a GUID  6405028a-5b3b-447e-bcb0-8c3a6368497a, then according to the structure given above, it is version 4 (marked in bold). You can use online tools to generate a GUID (Refer here)or you can also generate yourself. It will be out of the scope of this course to teach how to do that.

Why do we need to use GUID?

As I discussed in the first section, GUID is used as a global identifier. The need for GUID is pretty simple. We need to have something that can be recognized globally without any collisions. It is quite simple and easy to develop something unique locally. For example, in a class of 60 students, Roll number can act as a unique identifier. If I take it to the upper level, Roll no. 5 will be in every section/class. So if we are talking about a particular standard like the tenth, we can use another identifier which contains a symbolic alphabet in front of roll number to distinguish. We can also take it to the next level and check the map every student with another identifier such as the admission number, which is unique. But, we can only manage like this locally, i.e. up to this level. What if we want to map another school too? Here is the main problem. We need something unique not only on the local level but also on the global level.

We do not need to implement GUID in a case like a school as I mentioned. I mentioned it to make you clear about where you will need it. School database is local most or all of the time. GUIDs are used when your database is affected globally. They are required mainly when you have multiple independent systems, or your database is accessed by global clients who are generating IDs and mapping their data, these IDs need to be unique all the time. These provide Global Unique Identifiers with greater advantages.

Advantages of using Global Unique Identifiers

  • You get a unique value and need not worry about a collision.
  • Helps in merging different databases since every GUID value will be unique, we can use it as a primary key.
  • Distribution of databases becomes easier across multiple servers.
  • Global Unique Identifiers can be generated offline.

As you know, nothing perfect exists in this world. Global Unique Identifiers comes with a few disadvantages.

Disadvantages of using Global Unique Identifiers

  • Takes a lot of space. Normally a 4-byte identifier can be used. It takes 4 times more space.
  • Although GUID is unique across all databases, we cannot use it as a parameter to order the data in a particular order.

So, we should end this tutorial here summarising about Global Unique Identifiers. GUIDs are a unique global identifier that is unique across every database and every server. It is so simple to generate and use that no central authority exists to assign the GUIDs. While it is hugely popular for its pros, it comes with a little cost. But tradeoffs are present everywhere. We will make use of this Global Unique Identifiers in Postman now in the next tutorial.

Publish Jenkins HTML Reports for Newman
Publish Jenkins HTML Reports for Newman
Previous Article
GUID in Postman
GUID in Postman
Next Article
Harish Rajora
I am a computer science engineer. I love to keep growing as the technological world grows. I feel there is no powerful tool than a computer to change the world in any way. Apart from my field of study, I like reading books a lot and developing new stuff.
Reviewers
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles

Feedback