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
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
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
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
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
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
44



















