List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:January 21 2011 3:23pm
Subject:RE: best way to have a unique key
View as plain text  
>-----Original Message-----
>From: vegivamp@stripped [mailto:vegivamp@stripped] On Behalf Of Johan De
>Meersman
>Sent: Friday, January 21, 2011 1:22 AM
>To: Anthony Pace
>Cc: Michael Dykman; mysql.
>Subject: Re: best way to have a unique key
>
>I have to say, something similar was my first thought, too - you never
>mention uuid in your original post. As already stated, uuid() should be a
>Universal Unique IDentifier. It's afaik a random 128-bit number; given the
>space to choose from it should be rather unique. I have to admit that I'm
>not entirely confident about that myself, either, though: as Pratchett put
>it, one-in-a-million chances tend to pop up nine times out of ten.
>
[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.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: jerry@stripped
Web site: www.the-infoshop.com



>The code should have bits for handling duplicate primaries regardless of the
>method used to generate it, tough, so there's no reason to not do it. Having
>two subsequent UUID() calls generate pre-existing numbers seems to me to be
>likely in the same way as having Bush return his dirty oil dollars to Irak.
>
>On Thu, Jan 20, 2011 at 8:10 PM, Anthony Pace 
><anthony.pace@stripped>wrote:
>
>> Dude, come on.  I know that all primary keys have to be unique; however, I
>> was obviously referring to the use of uuid over auto incrementation.
>>
>> On 1/20/2011 1:36 PM, Michael Dykman wrote:
>>
>>> It is axiomatic in the relational model that a primary must be unique.
>>>  This is not a quirk put forth by your current employer.  Neither
>>> MySQL nor any other RDBMS will allow you to establish a primary key
>>> that is not unique.
>>>
>>>  - michael dykman
>>>
>>> On Thu, Jan 20, 2011 at 1:32 PM, Anthony
> Pace<anthony.pace@stripped>
>>>  wrote:
>>>
>>>> Due to certain reasons, the company I am doing business with has decided
>>>> that the primary key, for an orders table, be a unique key; however, I
>>>> don't
>>>> like the possibility of it conflicting if moved to another machine.
>>>>
>>>> What are some pitfalls of using a unique key, that is generated by a
>>>> server
>>>> side script, rather than by mysql?
>>>> What are the best ways to do this?
>>>>
>>>> Please keep in mind this variable will also be displayed on the
>>>> customer's
>>>> Receipt, but again, since it's random, it doesn't have to mean anything.
>>>>
>>>> --
>>>> MySQL General Mailing List
>>>> For list archives: http://lists.mysql.com/mysql
>>>> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>>
>>
>
>
>--
>Bier met grenadyn
>Is als mosterd by den wyn
>Sy die't drinkt, is eene kwezel
>Hy die't drinkt, is ras een ezel



Thread
best way to have a unique keyAnthony Pace20 Jan
  • Re: best way to have a unique keyKrishna Chandra Prajapati20 Jan
    • Re: best way to have a unique keyAnthony Pace20 Jan
      • Re: best way to have a unique keyLuciano Furtado20 Jan
    • RE: best way to have a unique keyDaevid Vincent20 Jan
Re: best way to have a unique keyAnthony Pace20 Jan
  • Re: best way to have a unique keyAnthony Pace20 Jan
    • Re: best way to have a unique keyMichael Dykman20 Jan
  • Re: best way to have a unique keyJohan De Meersman21 Jan
    • RE: best way to have a unique keyJerry Schwartz21 Jan
      • Re: best way to have a unique keyMichael Satterwhite21 Jan
    • Re: best way to have a unique keyMichael Dykman21 Jan
      • RE: best way to have a unique keyJerry Schwartz21 Jan