4 ms·
Don’t store UUIDs as strings. Use the native UUID data type, which only uses 16 bytes (UUIDs are basically just 128 bit integers). That is still double the siz
by daigoba66 9y ago
Don’t store UUIDs as strings.
Use the native UUID data type, which only uses 16 bytes (UUIDs are basically just 128 bit integers). That is still double the size of a 64 bit integer, but the trade off is that it can be random and universally unique.
- 33degrees 9y ago... for databases that have a native UUID type. MySQL doesn't, and the choices are either store them as strings or store them as non readable bytes. Not the greatest options.
- dragonwriter 9y agoYou can store them as bytes and use a function to convert them to/from a display format (which is what DBs with a built in UUID type do under the covers.)
- 33degrees 9y agoYes, and I've done that in the past; it's still somewhat laborious though.