Skip to content

UUID

Universally Unique Identifier

Medium — good to knowDatabase

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."

Made with passive-aggressive love by manoga.digital. Powered by Claude.