vawkern (@vawkern) header
vawkern (@vawkern) profile picture

20 • Backend/Data engineering • Backend • AWS Certified

Joined August 2025
Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)Photo by vawkern (@vawkern)
Anatomy of UUID: how a 36-character string holds more unique combinations than 10 trillion times the number of stars in the observable universe
3
1
5
103
since UUIDv4 is 100% pure randomness when a new UUID record arrives, it doesn't neatly append to the end it gets forcefully squeezed randomly into the middle of the sorted list this forces the database to constantly split and shift memory this kills insertion performance,
1
5
29
but wait, doesn't that mean anyone can reverse-engineer the first 48 bits to see exactly when a UUIDv7 was created? yes. and sometimes, you don't want to leak that data
1
5
23
so here is the rule of thumb: auto-increment: for local development & simple internal tables UUIDv4: for strict security, session tokens, and total opacity UUIDv7: for production databases and massive insertion performance every architecture has trade-offs choose wisely
5
25
to know why UUID v4 breaks performance, understand why databases index primary keys in the first place imagine finding one specific name in a 10,000-page book, without an index you have to read every single page an index sorts the data so the database can find it instantly
1
5
27
to index primary key, database uses B-tree data structure firstly PK column is sorted value wise, then seperate memory is alloted for that sorted values and the memory values point to the exact values in the column in auto-increment, the values are already sorted incrementally
1
5
32
the hyphens in a UUID aren't just for readability. they divide the string into a strict 8-4-4-4-12 format this structure acts like a map, letting systems instantly spot the metadata like the version and variant hiding in plain sight:
1
5
26
we know the math, we know the anatomy it seems like the ultimate, decentralized primary key you can generate them offline forever without a collision if you actually use this standard UUID (v4) in your database, it will secretly destroy your performance
1
5
23
for strings with only numbers, we get 10 combinations each character let say for example: if string has 2 characters, total unique values of that string: 10 combination (char 1) x 10 combination (char 2) = 10² = 100 unique values thats 10³² for UUID it it only had numbers
1
5
44
UUIDs are Hexadecimal (Base-16) instead of 10 combinations per character, you get 16 (0 to 9 + a to f) the math isn't 10 × 10, it's 16 × 16 for a 32-character string, the total uniqueness jumps from 10³² all the way to 16³² -(5.3 undecillion)
1
5
35
UUIDs are astronomically unique they require zero coordination no central server counting numbers millions of computers can generate UUIDs in complete offline silos, and none of them will ever collide but wait, how can a 36-character string hold that much uniqueness?
1
5
35
my first intuition: if it's a 36-character string minus 4 hyphen, it should hold unique combinations up to 9999... (written 32 times) huge, but that doesn't seem "astronomically " unique but then it clicked this holds letters as well it is vastly more than what i imagined
1
5
32
auto-increment works simply by assigning sequential values to primary key (1, 2, 3) for each new record but there is a massive flaw you can't merge two offline databases because ID #4 in Database A will conflict with ID #4 in Database B uuid solves this:
1
5
33
if you've touched a database, you know UUIDs we use them instead of auto-incrementing integers to identify data but why? doesn't counting 1, 2, 3 work just fine? 1, 2, 3 only works if one central server is doing the counting the secret to UUIDs is in the first U: universal
1
5
43
Day 6/100 - finished responsive desgin module from the course - worked on solo project - how fraction (fr) unit works - CSS GRID ( grid-template, span, grid-area-template) - repeat() , minmax() and grid-auto-rows, auto-fit
2
1
5
1,131