I assign each mysql row with a random code. Only alphanumeric lowercase characters and numbers are used.
These random codes are used for SELECT and JOIN queries.
Most often I use length of 24 characters which gives roughly 2.2x10^37 available combinations.
What is the perfect random code length that does not require checking for duplicates while being certain no collisions will occur but also keeping query result time to minimum?
Note: On big tables I use INDEX for the random code column of length 24.