List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:September 17 2005 7:40pm
Subject:Re: UUIDs - first usage for me
View as plain text  
In the last episode (Sep 17), Christian Parpart said:
> On Saturday 17 September 2005 08:34, Gleb Paharenko wrote:
> > mysql> show create table ui\G;
> >
> > Table: ui
> > Create Table: CREATE TABLE `ui` (
> > `uuid()` varchar(36) NOT NULL default ''
> I've been testing your example as I feel really much safer with UUIDs
> instead of auto_increments, however, my column datatype is
> VARCHAR(12) so 24bytes shorter than a usual UUID, although, all
> uuid() SELECTs differ only in first 12 bytes - why?

The node-based uuid format that mysql generates has this format:

time_low "-" time_mid "-" time_high_and_version "-"
clock_seq_and_reserved clock_seq_low "-" node

Node should be contant as long as you don't switch network cards in the
machine, clock_seq is usually only reset across reboots (or mysql
restarts since mysql currently generates its own uuid even if the OS
provides a uuid generator), and time is a timestamp accurate to 100
nanoseconds.  So assuming a single mysql server that doesn't get
rebooted, you'll only ever see different values in the first three
hyphenated fields.

See RFC 4122 for more details. is a
nice uuid library that includes a uuid decoder.

	Dan Nelson
UUIDs - first usage for mesean c peters16 Sep
  • Re: UUIDs - first usage for meGleb Paharenko17 Sep
    • Re: UUIDs - first usage for meChristian Parpart17 Sep
      • Re: UUIDs - first usage for meGleb Paharenko17 Sep
      • Re: UUIDs - first usage for meDan Nelson17 Sep
        • Re: UUIDs - first usage for meChristian Parpart21 Sep