How Unique is a GUID

D

Davinder

Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?


Thanks
Davinder
 
M

Michael Nemtsev

Hello Davinder,

http://en.wikipedia.org/wiki/GUID
http://en.wikipedia.org/wiki/Universally_Unique_Identifier

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

D> Basically I have two web applications and I need to pass a couple of
D> session variables between them using a table in a database. I have
D> set this up and used a GUID as a key for the table and it all seems
D> to work fine but I'm a little concerned about the uniqueness of the
D> GUID.
D>
 
A

avh

Davinder said:
Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?


Thanks
Davinder



Hi Davinder,

A GUID is GLOBALLY unique.
Trust me: from the moment on this wouldn't be the case anymore, a lot of
applications will get into trouble.
It contains reference to the unique MAC address of the network adapter +
random bytes + date/time etc ...

On Windows NT servers in the past GUIDs produced consecutively GUIDS (unique
still though), but this has changed in future versions of Windows.

Wim
 
A

avh

Davinder said:
Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?


Thanks
Davinder


Since it is GLOBALLY unique, you can't be sure that this GUID will not be
re-used on Mars !,
so you might get into trouble if you are planning to use this for message
exchange with aliens ! :)
 
D

Davinder

Michael, Wim thanks for your replys, the info is very helpful.

after I had written the message I actually did a quick test and
produced 100,000 GUIDs from my web apps and there were no clashes, so
I guess it should all run without any problems.

Since it is GLOBALLY unique, you can't be sure that this GUID will not be
re-used on Mars !,
so you might get into trouble if you are planning to use this for message
exchange with aliens ! :)

ahh this may cause a problem in the future then! I was planning on
hosting one of the web apps on mars so aliens could use it, guess I'll
have to come up woth a workaround, oh well :eek:)

Davinder
 
K

Kevin Spencer

You should have read the Wikipedia article. You would have saved yourself
some trouble. The probability of 2 GUIDs being the same is about 1 in a
quintillion.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top