MySQL Forums
Forum List  »  Newbie

UUID Question
Posted by: Greg Hines
Date: March 08, 2010 05:48PM

Hi Everyone,

I want to add a UUID as the PK to my database and I've noticed that several of the characters repeat themselves in each UUID. eg:

mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 4de854ae-2b06-11df-b0da-ca39c11a3feb |
+--------------------------------------+
1 row in set

mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 4e5d8291-2b06-11df-b0da-ca39c11a3feb |
+--------------------------------------+
1 row in set

mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 4f58d4ea-2b06-11df-b0da-ca39c11a3feb |
+--------------------------------------+
1 row in set

mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 4f9bf4d9-2b06-11df-b0da-ca39c11a3feb |
+--------------------------------------+
1 row in set

2b06-11df-b0da-ca39c11a3feb is in every UUID. Just seems a waste to have a varchar(36) field when a varchar(8) would do the trick.

Can anyone explain this behaviour to me as I would not have expected the repeating of all these characters in the UUID?

TIA

Greg

Options: ReplyQuote


Subject
Written By
Posted
UUID Question
March 08, 2010 05:48PM
March 08, 2010 09:47PM
March 08, 2010 10:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.