On Friday, January 21, 2011 09:23:47 am Jerry Schwartz wrote:

> 
> [JS] A UUID (what Microsoft calls a GUID) is based in part on the MAC
> address of the generating device. Since MAC addresses are supposed to be
> unique across the known universe, so should a UUID.
> 

Not entirely true - and even when true your conclusion doesn't follow.

I'll be the first to admit that we are straining at gnats, here. Generating a 
UUID does not require a machine to have an Ethernet card. The presence of a 
Mac address is, therefore, not guaranteed. Even if the machine does have an 
ethernet card, the definition of the UUID suggests - but does not require - 
that it be used (I believe this is discussed in another reply). Even if it is 
used, there are still a (admittedly large) portion of it that is created by a 
random number generation. Assuming a reasonably good generator, it is still 
possible for a collision on a single machine. 

The question then becomes, how much of a problem is that? The odds are that 
I'll be LONG gone before that happens. But it could happen tomorrow. If it's 
just a matter of "Oops, lets do a rollback and go again", who cares? If it's a 
life sustaining mission critical problem where an atomic war starts if the 
transaction fails ... you might want to at least think about another key. 
Personally, I wouldn't lose sleep over it.

Another reasonable - and faster - source of a unique key would be to have a 
human set unique server id on each machine generating the key. In that case a 
two field primary key with the first being the server id and the second part 
being an auto_increment field should guarantee a unique key - at least until it 
wraps around. This, of course, assumes that the administrator that sets up the 
servers doesn't make a mistake with setting the server id. Which brings up the 
"how much of a problem would that be" question again.

Bottom line ... exactly how paranoid are you?

---Michael

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to