Programming
programming
identifiers
databases
What is UUID?
Definition
A UUID (Universally Unique Identifier) is a 128-bit identifier written as 32 hexadecimal digits in 5 groups: 550e8400-e29b-41d4-a716-446655440000. Version 4 UUIDs are randomly generated and have a collision probability so low it is effectively zero.
Why It Matters
UUIDs are used as primary keys in distributed databases, API resource identifiers, session IDs, and correlation IDs for tracing. Unlike auto-increment IDs, UUIDs can be generated independently on any machine without coordination, making them ideal for microservices.
Code Example
import uuid
my_uuid = uuid.uuid4()
print(my_uuid) # 7c9e3a6f-2b1d-4f8a-9c3e-1a2b3c4d5e6f
Language: python