

If a UUID is a 35-character String, storing said UUID as a String requires 35-bytes (1 byte per character).Īnd, that's just for the column value itself. Part of the index-size issue comes from how the value is stored. This post doesn't tackle all of those issues - I'm here to noodle on just one of them: larger indexes.

Consider this post a note-to-self more than anything. But, I'm not one of those people who knows much about low-level storage details, engine ramifications, data replication, or any of the many complex topics that go into database management. And yes, I love thinking deeply about database index design. To be clear, I am not a database expert! Yes, I love writing SQL. This post looks at performing this String-to-Binary conversion in ColdFusion. And, based on what I've been reading, it seems that being able to convert a UUID string to and from a binary value is an important point of know-how. As such, I wanted to start building up some foundational knowledge. Or, more specifically, using something like a UUID (Universally Unique Identifier), GUID, or CUID as a table's primary key.
#MYSQL UUID FUNCTIONS CODE#
The other day, while recording a Working Code podcast episode, I mentioned to Adam that a big blind-spot in my database mental model was storing non- AUTO_INCREMENT primary keys.
