3 ms·
That depends on your DB (and DBAs/developers). A good database has a specific UUID type which stores the value as packed as it can be in 16 bytes. Even without
by dspillett 11y ago
That depends on your DB (and DBAs/developers). A good database has a specific UUID type which stores the value as packed as it can be in 16 bytes.
Even without explicit support you could conceivably write a wrapper as part of your data access layer which packs them better (as 16 character strings assuming fixed 8-bits/character string types are truly 8-bit safe which is a fairly safe bet, or as a composite key of a number of integer columns).
Of course that doesn't stop people storing them as text instead anyway. Worse: I maintain a legacy system (with not time/budget to refactor and regression test something this fundamental) where many are stored as two-bytes-per-character text (SQL Server's nchar type) so that is 74 bytes (58 wasted per UUID column per row per table/index).
"Sequential" UUIDs like the special type implemented in MS SQL Server helps on the compression front (even when stored as proper binary types and not text) but it you are relying on compression for that you probably have other issues to deal with too...