Guid
No edit summary
(One intermediate revision by the same user not shown)
Line 1: Line 1:
==== '''What is a GUID?''' ====
==== What is a GUID? ====
A '''GUID''' (Globally Unique Identifier) is a 128-bit integer used to uniquely identify resources.  
A GUID (Globally Unique Identifier) is a 128-bit integer used to uniquely identify resources.  


It is usually represented as a sequence of 32 hexadecimal digits grouped into chunks (e.g., <code>30dd879c-ee2f-11db-8314-0800200c9a66</code>). The format consists of 8-4-4-4-12 segments.
It is usually represented as a sequence of 32 hexadecimal digits grouped into chunks (e.g., <code>30dd879c-ee2f-11db-8314-0800200c9a66</code>). The format consists of 8-4-4-4-12 segments.


==== '''Uniqueness and Size''': ====
==== Uniqueness and Size ====
GUIDs are enormous numbers, nearly guaranteed to be unique. They provide approximately 2^128 (about 10^38) possible values.
GUIDs are enormous numbers, practically guaranteed to be unique. They provide approximately 2^128 (about 10^38) possible values. This vast range ensures that collisions (two identical GUIDs) are all but impossible to occur.


This vast range ensures that collisions (two identical GUIDs) are highly unlikely.
==== Context-Agnostic ====
GUIDs are not tied to a specific product or domain. They can be used for people, cars, files, webpages, colors, or anything else. Context determines the meaning of a GUID.


==== '''Context-Agnostic''': ====
==== Usage ====
GUIDs are not tied to a specific product or domain. They can be used for people, cars, files, webpages, colors, or anything else. Context determines the meaning of a GUID.
GUIDs are commonly used in databases, software interfaces, sessions, and more. They provide a unique serial number applicable to any item.


==== '''Advantages''': ====
==== Advantages ====
No central authority is needed for GUID management. GUIDs can be assigned to anything in the universe. They solve the problem of counting and managing unique IDs.
No central authority is needed for GUID management. In a standard MDriven created database each row is assigned a GUID. This makes object identity certain and makes creating APIs and connecting different databases together much easier. This means, for example, that two user objects created in two different systems can be told apart even with all other data is the same.


==== '''Usage''': ====
Have a GUID on each object is not a requirement, but is strongly encouraged.  
GUIDs are commonly used in databases, software interfaces, sessions, and more. They provide a unique serial number applicable to any item.


Remember, GUIDs are like gigantic ID numbers, ensuring uniqueness across the globe and even throughout the entire universe.  
==== Warning when designing databases ====
NEVER include a GUID in a database index. Because they are all unique, they can't be efficiently indexed. That's why a MDriven database uses easy to index integers for connecting tables with primary and foreign keys. Those Integer key values should be kept inside each database, not to be used outside a database instance. When transferring data between systems, either by copying or APIs, always use the GUID, not the row ID integer for object (row) identfication.


[[/betterexplained.com/articles/the-quick-guide-to-guids/|They’re a powerful tool for creating globally unique identifiers without the management overhead<sup>1</sup>]][[/dev.to/tkarropoulos/understanding-guids-2d1i|<sup>2</sup>]].
[[Category:TOC]]
[[Category:TOC]]

Revision as of 10:26, 26 April 2024

What is a GUID?

A GUID (Globally Unique Identifier) is a 128-bit integer used to uniquely identify resources.

It is usually represented as a sequence of 32 hexadecimal digits grouped into chunks (e.g., 30dd879c-ee2f-11db-8314-0800200c9a66). The format consists of 8-4-4-4-12 segments.

Uniqueness and Size

GUIDs are enormous numbers, practically guaranteed to be unique. They provide approximately 2^128 (about 10^38) possible values. This vast range ensures that collisions (two identical GUIDs) are all but impossible to occur.

Context-Agnostic

GUIDs are not tied to a specific product or domain. They can be used for people, cars, files, webpages, colors, or anything else. Context determines the meaning of a GUID.

Usage

GUIDs are commonly used in databases, software interfaces, sessions, and more. They provide a unique serial number applicable to any item.

Advantages

No central authority is needed for GUID management. In a standard MDriven created database each row is assigned a GUID. This makes object identity certain and makes creating APIs and connecting different databases together much easier. This means, for example, that two user objects created in two different systems can be told apart even with all other data is the same.

Have a GUID on each object is not a requirement, but is strongly encouraged.

Warning when designing databases

NEVER include a GUID in a database index. Because they are all unique, they can't be efficiently indexed. That's why a MDriven database uses easy to index integers for connecting tables with primary and foreign keys. Those Integer key values should be kept inside each database, not to be used outside a database instance. When transferring data between systems, either by copying or APIs, always use the GUID, not the row ID integer for object (row) identfication.

This page was edited 9 days ago on 04/29/2024. What links here