UUID
Universally Unique Identifier
ELI5 — The Vibe Check
A UUID is a randomly generated ID that looks like 'a3b4c5d6-...' and is practically guaranteed to be unique across the entire universe. Unlike auto-increment IDs (1, 2, 3), you can generate UUIDs on the client without asking the database first.
Real Talk
A UUID is a 128-bit identifier standardized by RFC 4122, typically represented as 32 hexadecimal characters in 8-4-4-4-12 format. Version 4 UUIDs are randomly generated with an extremely low collision probability. They are preferred over sequential integers when IDs must be globally unique or generated offline.
Show Me The Code
-- PostgreSQL with pgcrypto
CREATE TABLE sessions (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user_id UUID REFERENCES users(id)
);
When You'll Hear This
"Use UUIDs so users cannot guess sequential IDs." / "The frontend generates the UUID before sending the request."
Related Terms
Auto Increment
Auto increment means the database assigns the next ID number automatically every time you insert a row.
Primary Key
A primary key is the unique ID that every row in a table must have. Like a social security number for your data — no two rows can have the same one.
Table
A database table is exactly like a spreadsheet tab. It has columns across the top (name, email, age) and rows going down (one per person).