[FLOW3-general] Storing UUIDs as BINARY(16) in the database
Jochen Rau
jochen.rau at typoplanet.de
Sat Feb 13 00:12:38 CET 2010
Hi.
Currently the definition of fields storing UUIDs in FLOW3 is for example
"identifier" CHAR(36) PRIMARY KEY NOT NULL,
Today I dug a little bit deeper in the literature about MySQL and found
the following advise:
"If you do store UUID values, you should remove the dashes or, even
better, convert the UUID values to 16-byte numbers with UNHEX( ) and
store them in a
BINARY(16) column. You can retrieve the values in hexadecimal format
with the
HEX( ) function.
Values generated by UUID( ) have different characteristics from those
generated
by a cryptographic hash function such ash SHA1( ) : the UUID values are
unevenly
distributed and are somewhat sequential. They’re still not as good as a
monotonically increasing integer, though."
High Performance MySQL, 2nd Edition, By: Baron Schwartz; Peter Zaitsev;
Vadim Tkachenko; Jeremy Zawodny; Arjen Lentz; Derek J. Balling
O'Reilly Media, Inc.
Maybe that can be of interest for at least one of us ;-)
Jochen
More information about the FLOW3-general
mailing list