Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Reformatting GUIDs

Re: Reformatting GUIDs

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 21 Dec 2006 10:00:58 -0800
Message-ID: <1166724058.513151.197670@48g2000cwx.googlegroups.com>


hasta_l3_at_hotmail.com wrote:
> Charles Hooper a écrit :
>
> > Vladimir M. Zakharychev wrote:
> > > Charles Hooper wrote:
> > > > I wonder if you can look at this from a different direction. What if
> > > > you use the random number generating capabilities to generate each of
> > > > the hex numbers between the dashes?
> > > >
> > > > For example, the second section of the GUID contains a four character
> > > > hex number. If you have Oracle provide a hex number between hex 1000
> > > > and hex FFFF, that would be sufficient to satisfy that portion of the
> > > > GUID. If you pre-convert the hex numbers to their decimal equivalents,
> > > > you will save Oracle a little work, but it will be more difficult to
> > > > see what is happening.
>
> [...]
>
> > >
> > > The only problem with this approach as I see it is that use of
> > > DBMS_RANDOM will probably have adverse effect on "GU" part of the
> > > "GUID" (GU = Globally Unique.) SYS_GUID() guarantees that all returned
> > > values are globally unique, because afaik it uses system timestamp and
> > > unique host information for GUID generation, among other things.
> > > DBMS_RANDOM doesn't guarantee uniqueness of returned values, only
> > > randomness.
> > >
> >
> > I am not disagreeing with you, but I believe that the random number
> > generator in Oracle can be seeded with the system time. The reason
> > that a GUID is thought to be unique is due to the range of possible
> > values, essentially 15 * 16^31 (or if the first digit can also be a 0,
> > 16^32, or 16 * 16^31).
>
> Yes and no, Charles...
>
> UUIDs are usually globally unique because they identify a single point
> in space-time - that is they are essentially a concatenation of
> system time and node MAC address.
>
> You are correct in that a variant uses a random generator (which must
> be of cryptographic quality) , but note that even this variant has a
> well
> defined internal structure, that is required for a true uuid.
>
> > Note that there is nothing stopping the OP from calling sys_guid() five
> > times, each time extracting a different sub-string portion of the value
> > returned.
>
> Well, I may be wrong but I have a feeling that the OP may generate
> the same identifier twice with this algorithm, if mischance wants that
> a sub-string of the guid system clock component overflows...
>
> BTW, if you are interested, the RFC on the subject is here :
> http://www.ietf.org/rfc/rfc4122.txt
>
> Have a nice day, Charles
>
> --- Raoul

Raoul, thanks for the link. It looks like there is more order to a GUID than I originally thought.

Although now I wonder if GUIDs "supports very high allocation rates of up to 10 million per second per machine", if there are 200,000,000 computers producing GUIDs at this rate, would there be no duplicated GUIDs until the year 3400?

SELECT
  10000000*200000000*60*60*24*365.24 CALCS_PER_YEAR FROM
  DUAL; CALCS_PER_YEAR


    6.3113E+22

At this rate, would it take 1,394 years before a duplicate GUID is generated? Just food for thought.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Thu Dec 21 2006 - 12:00:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US